### Random Post

### Recent Posts

### Recent Comments

Jim Randell on Enigma 544a: Merry Christ… | |

Jim Randell on Puzzle #52: Bus change | |

J. Pijnenburg on Puzzle #52: Bus change | |

Jim Randell on Puzzle #53: Painting by n… | |

GeoffR on Puzzle #52: Bus change |

### Archives

### Categories

- article (11)
- enigma (1,367)
- misc (4)
- project euler (2)
- puzzle (90)
- puzzle# (48)
- site news (58)
- tantalizer (93)
- teaser (7)

### Site Stats

- 233,055 hits

We have encountered

Automorphic Numbersbefore. See:Enigma 49,Enigma 1736.We can solve this puzzle using the [[

`SubstitutedExpression()`

]] solver from theenigma.pylibrary.The following run file executes in 155ms.

Run:[ @repl.it ]Solution:The PIN is 0625.Without the final condition we see that there are four candidate 4-digit PINs: 0000, 0001, 0625, 9376, but only one of these has exactly one zero digit.

As noted in

Enigma 49, when typed using a phone keypad the word ZERO uses the digits 9376, which would be a sneaky way for the PIN to include ZERO, but it doesn’t fit with the wording for this particular puzzle.The puzzle is so popular that it also appeared in Sunday Times Teaser 2982, Pin Head

https://sites.google.com/site/sundaytimesteasers/other-teasers/pin-head

It’s not Sunday Times Teaser 2982, that’s the number for this week. It’s dated March 2015, but doesn’t appear in the list of teasers for hat period.

Well spotted Robert, I didn’t notice that the number at the top didn’t match the puzle.

I found that I had to represent the PIN as a string and an integer to preserve the leading zero digit when the four permutation integers are converted to a 4-digit integer.

The [[ SubstitutedExpression() ]] solver obviously solves this issue too i.e. of preserving leading zero digits.

Yes. In the [[

`SubstitutedExpression()`

]] solver the [[`--invalid`

]] option controls what values the symbols can take on. The default is to disallow leading zeroes, but by setting it to an empty value any of the symbols can take on any of the values.@geoff: We can find the four 4-digit numbers with the required property fairly easily:

And we can output them using a format specifier of [[

`"{n:04d}"`

]] if we want to see the leading zeros, so:I noticed your program enforces the condition that all the digits in the PIN are different, which is not required, and obviously won’t find the potential PINs 0000, 0001.

P^2 – P = 10,000 * n = (16 * x) * (625 * y)

By inspection P = 0000 or 0001, both of which are invalid.

Or 16 * x = 625 * y +/- 1

For 16 * x = 625 * y + 1, y = 15, x = 586 which gives P = 9376

For 16 * x = 625 * y – 1, y = 1, x = 39, which gives P = 0625

…y = 17, x = 664 is the next solution, but n > 10,000 (P = 10625)