Sunday Times Teaser 2931 – Unfortunate 57
by Susan Bricket
Published November 25 2018 (link)
In the early days of the internet, I used a secret shorthand for my important passwords: Bank=1/7, Credit Card=2/7, ISP=3/7, etc. Like all fractions, the decimal expansions
\[\frac{1}{7} = 0.142857142857142 …, \frac{2}{7} = 0.285714285714285 …\]
eventually repeat themselves, in this case in sequences of six digits. In each case, my password was the set of digits that repeat (“Unfortunate 57” is a mnemonic for 142857). As password requirements became stricter, I changed my system to base 11, using an X for the extra digit for “ten”; so for instance in base 11
\[234 =1×11^2 + 10×11^1 + 3 ×11^0 = 1X3_{11}\]
and
\[\frac{1}{2} =0.5555 … = \frac{5}{11^1} +\frac{5}{11^2} + \frac{5}{11^3} + …\]
In the sequence 1/2, 1/3,…, what is the first password of length greater than six that my base-11 system produces?
For Enigma 1247 [ https://enigmaticcode.wordpress.com/2015/03/20/enigma-1247-recurring-decimal/ ] I wrote the [[ recurring() ]] function, which will calculate the recurring representation of a fraction in a given base.
We can use this routine in a short program to solve this Teaser:
Run: [ https://repl.it/@jim_r/teaser2931 ]
(Note the output will use ‘A’ for the digit 10, not ‘X’).