When the last number is known, the first number has the same remainder as the last number when divided by 4. The second number is one of the possible first numbers plus 2 (wrapping to 0 at 40). The range of numbers is 0 to 39.
Example output if the last number is 19:
3-5-19 3-9-19 3-13-19 ... 39-33-19 39-37-19 39-1-19
My current attempt is posted below. Enjoy :)
(I suspect further restrictions can be made to the key space to reduce the number of possible combinations (ie first and last number can't be the same) but this initial iteration does not consider these.)
[1] With reference to:
http://www.dontforward.com/masterlock.htm
http://www.fusor.us/lockpick.html
master_lock_combo(19); sub master_lock_combo { #0 1 2 3 4 5 #12345678901234567890123456789012345678901234567890 @x=grep{$_[0]%4==$_%4}0..39;for $i(@x){for (map{($_+2)%40}@x){print"$i-$_-$_[0]\n"}} }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (Golf) Master lock combinations
by Transient (Hermit) on Jun 23, 2005 at 19:50 UTC | |
|
Re: (Golf) Master lock combinations
by kaif (Friar) on Jun 23, 2005 at 22:40 UTC | |
by hv (Prior) on Jun 24, 2005 at 02:48 UTC | |
by Anonymous Monk on Jun 24, 2005 at 04:30 UTC | |
by themage (Friar) on Jun 26, 2005 at 16:57 UTC | |
|
Re: (Golf) Master lock combinations
by thospel (Hermit) on Jul 01, 2005 at 21:50 UTC | |
|
Re: (Golf) Master lock combinations
by chipmonkey (Initiate) on Jun 27, 2005 at 22:51 UTC |