Originally posted by talzamir
A door has an electronic lock with a two-digit code of zeros and ones. When gives a sequence of entries it looks at the latest two keys pressed, in sequences. If the last 2 are right right combination the lock opens; if nothing is pressed for a few seconds, the lock clears its memory. Obviously the combination is 00, 01, 10 or 11. I could type
a ...[text shortened]... ation - 1.
Does that apply also for longer combinations? Also for codes that are not binary?
It does for three combinations. That needs 0001110100 (amongst others; 1000111010 would work as well, and is the same length). I haven't tried for four or more yet, but I suspect you are right.
And, being a programmer, I would have no idea about anything which isn't binary
It is quite possible that you'd find the answer in Knuth, but I think it would have to be in one of the volumes which are as yet to be published. Unless he's got round to publishing vol. 4 when I wasn't looking; AFAICT it should be in that. But it's a fascinating problem, in any case.