### Random Post

### Recent Posts

- Tantalizer 450: Marriage problems
- Enigma 1057: Recycled change
- Enigma 452: Figure out these letters
- Puzzle 46: I lose my specs
- Enigma 1058: A row of colours
- Enigma 451: Double halved
- Tantalizer 451: Death rates
- Enigma 1059: Century break
- Enigma 450: A pentagonal problem
- Puzzle 48: Verse on the island

### Recent Comments

Jim Randell on Tantalizer 450: Marriage … | |

Brian Gladman on Enigma 1057: Recycled cha… | |

Jim Randell on Enigma 1057: Recycled cha… | |

geoffrounce on Enigma 452: Figure out these… | |

Jim Randell on Enigma 452: Figure out these… |

### Archives

### Categories

- article (11)
- enigma (1,183)
- misc (2)
- project euler (2)
- puzzle (46)
- site news (46)
- tantalizer (50)
- teaser (3)

### Site Stats

- 184,974 hits

Advertisements

Here’s a Python 3 solution. It runs in 234ms. I’ll probably try another version as I have a natural dislike for

floats(although I’m sure 64-bit floats are up to the job for this puzzle).Solution:The ants had marched 11cm along the wire.We can remove the need to use

floatsby using a co-ordinate system where the axes are 60° apart (instead of the more usual 90°). The distance metric is given by the cosine rule, and I only track the squares of the distances to keep things in the integers (although I do calculate the actual distances in order to display the solution). This Python program runs in 40ms.Tidied up version

Another variation on the same theme, restricting the points reached to the quadrant where x and y coordinates are non-negative, and not considering steps that would always reduce the distance from the start point.