### 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

This Python program runs in 56ms.

Solution:(a) The left-hand key sounds note A; (b) Yes; (c) No.For (a) the keys are (40, 30, 45, 27, 36, 24, 32, 48) with 36 and 48 in the correct positions.

The ratios between adjacent notes are (4/3, 2/3, 5/3, 3/4, 3/2, 3/4, 2/3).

For (b) there are several possible arrangements (given below, along with the ratios):

(30, 45, 27, 36, 48, 32, 24, 40), (2/3, 5/3, 3/4, 3/4, 3/2, 4/3, 3/5)

(32, 48, 36, 27, 45, 30, 40, 24), (2/3, 4/3, 4/3, 3/5, 3/2, 3/4, 5/3)

(45, 30, 40, 24, 32, 48, 36, 27), (3/2, 3/4, 5/3, 3/4, 2/3, 4/3, 4/3)

(48, 32, 24, 36, 27, 45, 30, 40), (3/2, 4/3, 2/3, 4/3, 3/5, 3/2, 3/4)

(48, 32, 24, 40, 30, 45, 27, 36), (3/2, 4/3, 3/5, 4/3, 2/3, 5/3, 3/4)

For (c), there are no arrangements with more than two notes in the correct position (all layouts have 0, 1 or 2 notes in the correct position). Which means we don’t have to consider how to extend the condition stated as “the interval (frequency ratio) between the two notes I did get right was one of these” to more than two notes in the correct position.

This is a little slow, but as short as I could make it easily.

#artcode #programmingasanartform #codeart

The computer gives a result for (A) of 40, (B) a resounding yes and (C) a resounding NO! It only takes a few seconds to run, which is much faster than I could do it in my head! I tried to take some of your advice from the last question on board, I hope that’s evident in the efficiency of my code! Thanks again!

@liam: I don’t know if you want any hints, but if you are happy to use routines from Python’s standard library you could save yourself some typing replacing lines 2-18 with a single statement:

See the Python documentation on the

itertoolspackage for more details. It’s got quite a few useful routines for solvingEnigmatype problems (permutations(),combinations(),product()andcount()are the most useful).I tried a permutation solution and initially got four solutions. Some further manual analysis, listed in the comments in the code below gave the same note sequence as Jim and the same answers for parts (a), (b) and (c), which are initially commented out in the code below: