Skip to content

Sunday Times Teaser 2609 – String Art

by Andrew Skidmore

Published: 23 September 2012 (link)

Callum knocked some tacks onto the edge of a circular board. He then used pieces of string to make all possible straight-line connections between pairs of tacks. The tacks were arranged so that no three pieces of string crossed at the same point inside the circle. If he had used six tacks this would have required fifteen pieces of string and it would have created fifteen crossing points inside the circle. But he used more than six and in his case the number of crossing points inside the circle was a single-digit multiple of the number of pieces of string used.

How many tacks did he use?

4 Comments Leave one →
  1. Brian Gladman permalink

    Here is my solution:

  2. tonysmith permalink

    Brian – I can more or less follow this program apart from “and s & 1” in line 20 – what does this do?
    The obvious manual route is to solve “(n-2)(n-3)?0 mod 12 such that 7?n?12”. I assume that a simple program could do this.

  3. Brian Gladman permalink

    Hi Tony,

    The expression ‘s & 1’ is an alternative to ‘s % 2’ and gives 0 when s is even and 1 when it is odd. It treats the numbers on each side of the ‘&’ as binary and performs a bitwise ‘and’ on them.

    Using ‘s & 1’ in place of ‘s % 2’ makes no real difference here but in code where instruction speed matters, the former will generally be faster because it avoids a division operation.

    I need s to be odd so that s + 5 is even and hence yields an integer when it is divided by 2.

    Your version in Python:

    works just fine.

  4. tonysmith permalink

    Thanks Brian.
    I have learnt a (very) little bit about Python.
    In fact, since x is odd, I think s could only be odd.

Leave a Reply

Note: HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS