111122223333444455556666777788889999000011121113111411151116111711181119111011221123112411251126112711281129113011311321133113411351136113711381139114011421143114411451146114711481149115011521153115411551156115711581159116011621163116411651167116811691170117211731174117511761177 ... I give up
So the lock is a "bad" lock because, once you have punched correct numbers in sequence, punching incorrect ones doesn't make you start all over. Unfortunately, you must use the same approach on all future openings. The advantage of the normal "brute force" approach is that you get the correct combination when you are successful and you can use it over and over again.
Remarkably, there are, at time of writing, 189 comments - and not a single one has mentioned the fact that you have used the word "combination" when you should have used the word "permutation"!!!
Oh man this sounds like such a big problem, and I'm SOO certain it has a very simple and elegant answer we mere laymen humans won't find all that easily. I think I'll just wait for the solution :p
Great problem! This problem also applies to combination locks on a lot of suitcases where you rotate the numbered rings. The solution would have to resemble grey code to be efficiently put to use.
Spent all day going through both the 3 digit sequence and the 4 digit sequence.
The shortest 3 digit sequence is 29 digits : 33111211312212313213322232333
The shortest 4 digit sequence is 259 digits : 4441111211131114112211231124113211231134114211431144121213121412221223122412321233123412421243124413131413221323132413321333133413421343134414142214231424143214331434144214431444222232224223322342243232333234324232433244233423442424342443224443333433443434444
We found our solution by vertically aligning each permutation by overlapping the last two digits of one permutation with the first two digits of another. We also believe that we came up with a solution for how many digits any sequence would require. Let x = number of digits to choose from, let n = number of digits in the sequence, then x^n + (n-1) would give the number of digits required. Thus, 3^3 + (3-1) = 29.
max length for 3 digit combination only containing 1,2 and 3 would be 81 (3^4) digits long so looking for something less than that.
111222333121132131131332212323231(33 digits) got them all although some are repeated like 232 and 323. I think the general formula is n^k+(k-1) where n is the number of available digits and k is the number of digits for the lock. so for 3 digits and a 3 digit lock it will be 3^3+2=29 digits long. so for numbers 0-9 on a 4 digit lock it will be 10^4+3=10003
Alright so, I spent about 3 hours on the thought that the triple 1's, 2's and 3's were separated from each other. Found out that is impossible. I need sleep now x_x
I am going to conjecture that this lower bound is always achievable hence the general solution here is m^n+n-1 where n is the number of digits that can be entered chosen from m numbers. For his answer we had 4 numbers in a sequence and 10 choices giving 10^4+3=100003 as wanted. This is almost certainly the solution for every possible one and now just has to be proven that this is achievable which is gna be very hard.
Here is a general lower bound for n digits and m numbers (that may not be achievable). With n digits and m different numbers there are m^n possible combinations and to type in this many of ANY n digit numbers requires m^n+n-1 entries hence this is a lower bound. For example with 3 digits 3 numbers then 29 is a lower bound and any combination found which equals this will be the lowest combo. Given that someone above claimed they have done it in 18 numbers they must be wrong.
Shortest possible for 3 digits (other solutions possible):
111 222 333 121 131 321 232 213 323 (11)
I entered the last 2 digits between brackets, because I see it as a cycle. If you start anywhere in this sequence (without the final two), make it to the end, start again from the beginning and then type the two first numbers again, you'll have all of them.
Why have I split it up in groups of three? Don't know yet, but I guess there'll be patterns in such a way.
@Pizzscn still the sequence is not 29 digits long, which is the shortest solution you can come up with, and i guess he was referring to the lack of 121 and 111 in the 3 digit-sequence
@Zeldakitteh I'm getting a stack overflow, it's not just pure ram size. The problem might be with the deep recursion but I suspect it's actually the ArrayList which is probably not meant for such large lists. For more digits I'd write it in C++ without recursion and my own datatype. Properly optimised you could got to about 10 digits with 4GB of RAM.
I feel as if the strategy I would use is to list every combination and create a chain adding 1 number at a time and crossing off numbers as you go along. So the order would be starting with 1234, then doing a combo that includes 234X, then 34XY, then 4XYZ then XYZA and so on until you've crossed off every combo. Using this strategy on the 3 puzzle, I got an answer of:
311121131333122232213231233212
it solved itself (except I had 311 at the end which I easily stuck a 3 at the beginning).
For three digit combination of three digits, I have
11223213322212313233312111311,
which was solved graphically (using a directed graph). Such a solution is prohibitive in the next cases (drawing 259 lines between 16 points...) so I'll be doing those differently. But now I have two data points (plus the other strings in the comments) to look at the properties of!
Well, given m digits in an n digit combination, I can tell you that the shortest string will be m^n+(n-1). This is because you can drop (n-1) digits from every combination (of which there are m^n) save the last. As well, there are n digits in each of m^n combinations, so the number of digits is really n*m^n-(n-1)*(m^n-1), which is just m^n+(n-1).
But you already knew that. I'll have a solution to the problem later.
@singingbanana seriously dude, you're the first person to make math this interesting I've ever come across. Math education should start from solving *interesting* problems, and work backwards to let people figure out technique... and that's exactly what you're doing. I love it!
@excepto94 what is this? the possible combinations are 4^9, if you just write them down after one another you get 4^10 digits, which is about a fourth of your solution even without any optimization, while the optimum length should be way shorter.
@KyosBlog didn't think through it, thought of the handshaking problem and (don't know the English term for X^Y) to the number of well... numbers, but I didn't even thought I was right.
aww, you didn't say "If you have been, thanks for watching"
There is a misnomer in your description. You are asking us to solve a 2 digit sequence with 2 total digits, a 3 digit sequence with only 3 digits, and a 4 digit sequence with only 4 digits. But the lock doesn't use a 10 digit sequence. Why not ask us to figure out a 2 digit sequence with 3 digits, 3 with 5, 4 with 7. That would get us to practice for the real problem. Just my thoughts.
@singingbanana It was the first time I tested it. With some optimization I could get the 10003 solution as well. I'm going to try it later. If you want to see it yourself, I can upload to a webserver and private message you the link ;D
@Butt4cak3 Hm, I wrote one in like 20 lines of java code that always finds the shortest solution for all digit ranges (0-9 in this case) and lengths (4 in this case). :P
@GammahooX Excellent stuff. By the way, I'll be giving you a pen and paper solution - although a little intense when you have to write out a 10003 digit solution using pen and paper, which I did.
@singingbanana Well it starts getting hard above 4 digits (with 0-9) on the PC aswell. My simple and relatively fast way to solve it can not solve the problem for 5 digits due to memory limitations. However it would be possible to implement it in a more memory efficient, more complex and maybe slower way in C++.
My code can be found here: pastebin[.]com/bGdNwrUB
With 29 digits I think it's the shortest possible way.
Since you get a new 3-digit combination by adding 1 digit to a 3 digit combination and I need 27 different 3-digit combinations I took 3 random digits and added 26 more to have the 27 different possibilities. Making an answer with 29-digits the shortest possible answer.
I hope people can understand my explanation. if you don't you can just ask me and I'll try too explain it better.
Take the sequence for every combination of four numbers, and repeat the pattern for solving for the 1234 combination, but then 2345, 3456, .... After that, 1235, skipping any four consecutive without a 5, and so on, then 1236, 1237, 1238, 1239, 1230, 1245,6,7,1256,7,8, and so on, until 6890.
@orcyngiser Use Eulerian path to solve this problem seeing possible digits as nodes and combinations as paths, you would get De Bruijn sequence(s) with B(N, K) = K^N digits, then because the property of the cyclic group, you need another (N-1) attached to the end, in this case it is 10^4+4-1 = 10003, I feel like cheating since I am a math grad student...until I took an arrow in the knee.
I know how to get into the lock easily its the same type of lock that is on the door to the office where i work, in a charity shop! If you simply put a number in and turn and keep the dial turned click C (cancel) and then if you hear a click its a number(repeat 0-9), The lock you showed is very simple and actually works on a down or not idea, basically you can put the four numbers in ANY order and click the letter X, Y or Z
I know its not the mathematical solve that you wanted but its a solution
on the 123 lock, given that there are (I think) 27 possible combos, am I right in saying that the correct sequence would be (3 + 26) = 29 digits long?
There are multiple answers. The process of finding an answer is very simple.
First write all states that are possible - 10k in this case. Now draw an arrow from each state to the one that would be obtained by adding a digit to it. For example, from state 1234 draw arrows to 2340, 2341...2349. After this, find a path that covers all states exactly once. There are multiple such paths and each corresponds to an answer.
Length of the solution is number of states + length of combination - 1 = 1003
@sid2089 So you've turned this question into an excercise in graph theory. That's a great idea I would've never had. Is there an simple algorithm for finding the traversal of an oriented graph without visiting a vertex twice? Otherwise I might just use backtracking to find a solution.
so far, I have 000010002000300040005000600070008000900, but after that it gets a bit tricky. If i put another 0 down, I would repeat something no matter what I put after it. I believe it should be a 1, but then unsure as to where to go from there.
The shortest sequence for the 3-digit 1-3 lock is 29 digits long and for the 4-digit 1-4 lock is 259 digits long. I don't think I'll be posting the latter sequence today.
Such sequences are called De Bruijn sequences. I believe the minimum length of a sequence of "m" digits of length "n" is m^n, but i completely forgot how to determine the exact sequence. It's been a while since I read about this.
@ZeldaGirl35 There are 27 combinations, so 27x3=81 digits all together - but there is a sequence that is much shorter but still contains all possible 3-digit combinations.
i put spaces in just to help you see the numbers.this is just going through every combination... lol but it works i think. take a long time to do it this way.
i believe this works but... it is inefficient. numbers will be repeated doing it like this
111211311221231213213313222323332. Not sure it's the shortest but they're all in there.
yourmum3121 3 days ago
naradia95 3 days ago
4 digit
111122223333444455556666777788889999000011121113111411151116111711181119111011221123112411251126112711281129113011311321133113411351136113711381139114011421143114411451146114711481149115011521153115411551156115711581159116011621163116411651167116811691170117211731174117511761177 ... I give up
LegendofStalfos 3 days ago
does the lower half of his body move this much ?
Pianoguy32 3 days ago
111222333112113221223332331321321313212121313213132313232132-3 digits
321432143241324132413241342413413413241341321434213421341314-4 digits
34321532415234153415432532415321543245315432542313542353415132415324153245431524542351234532151344235214325324143251432151-5 digits
brianawesome100 5 days ago
I solved the sequence for all 1 digit combinations using 0 thru 9! Yaaaaay!!
subsystems 6 days ago
What?! I recognize this face! Hello from a Numberphile's viewer. Definitely subscribing.
Gytax0 1 week ago 34
@Gytax0 Hello!
singingbanana 1 week ago 12
So the lock is a "bad" lock because, once you have punched correct numbers in sequence, punching incorrect ones doesn't make you start all over. Unfortunately, you must use the same approach on all future openings. The advantage of the normal "brute force" approach is that you get the correct combination when you are successful and you can use it over and over again.
Cool.
CNN911Fakes 1 week ago
Remarkably, there are, at time of writing, 189 comments - and not a single one has mentioned the fact that you have used the word "combination" when you should have used the word "permutation"!!!
ThBearsFriend 3 weeks ago 2
@ThBearsFriend because people dont get hung up on the notation when everyone including you understand what problem is asking for.
hussein688 3 weeks ago
33322211121223113123213233133 for three digits
eddyproca 2 months ago in playlist My Maths Videos
I don't know what just happened
allyamezola 2 months ago
there are quite a few possible answers...ryt!?
geeta172 2 months ago in playlist My Maths Videos
so.... the 3 digit code is going to be 29 digits long....?? @@
JRocKinPENANG 2 months ago
I dont get it :(
coolster01 2 months ago
You didn't say "If you have been, thanks for watching." :(
iTmcb 2 months ago
DAMMIT BANANA! IM A PHYSCHOLOGIST! NOT A MATHEMATICIAN! Oh well ... lets see nao... Would a magnet and a screw driver work on opening said lock?
FanaticDamen 2 months ago
so every combination in the sequence must be unique?
tonix1993 2 months ago in playlist My Maths Videos
@tonix1993 Yup If possible.
singingbanana 2 months ago
Comment removed
neowes0 2 months ago in playlist My Maths Videos
Comment removed
neowes0 2 months ago in playlist My Maths Videos
Comment removed
neowes0 2 months ago in playlist My Maths Videos
Oh man this sounds like such a big problem, and I'm SOO certain it has a very simple and elegant answer we mere laymen humans won't find all that easily. I think I'll just wait for the solution :p
Great problem! This problem also applies to combination locks on a lot of suitcases where you rotate the numbered rings. The solution would have to resemble grey code to be efficiently put to use.
FHomeBrew 2 months ago
3 digits: 11121131221231322233232133311
Berntisso 2 months ago
Comment removed
marcoser926 2 months ago in playlist Uploaded videos
Spent all day going through both the 3 digit sequence and the 4 digit sequence.
The shortest 3 digit sequence is 29 digits : 33111211312212313213322232333
The shortest 4 digit sequence is 259 digits : 4441111211131114112211231124113211231134114211431144121213121412221223122412321233123412421243124413131413221323132413321333133413421343134414142214231424143214331434144214431444222232224223322342243232333234324232433244233423442424342443224443333433443434444
Fishpizza1212 2 months ago in playlist Uploaded videos
Mr. Curran's 3rd Hour Discrete Math Solution:
11121232312221313223331133211
We found our solution by vertically aligning each permutation by overlapping the last two digits of one permutation with the first two digits of another. We also believe that we came up with a solution for how many digits any sequence would require. Let x = number of digits to choose from, let n = number of digits in the sequence, then x^n + (n-1) would give the number of digits required. Thus, 3^3 + (3-1) = 29.
smsdiscrete 2 months ago 8
3 digit code: 1 1 1 2 1 1 3 1 2 2 1 2 3 1 3 2 1 3 3 2 2 2 3 2 3 3 3 1 1
4 digit code: 1111211131114112211231124113211331134114211431144121213121412221223122412321233123412421243124413131413221323132413321333133413421343134414142214231424143214331434144214431444222232224223322342243224423232423332334234323442424332434244324443333433443434444111
mihassan 2 months ago
De Bruijn sequences! ;)
DrMikero 2 months ago
max length for 3 digit combination only containing 1,2 and 3 would be 81 (3^4) digits long so looking for something less than that.
111222333121132131131332212323231(33 digits) got them all although some are repeated like 232 and 323. I think the general formula is n^k+(k-1) where n is the number of available digits and k is the number of digits for the lock. so for 3 digits and a 3 digit lock it will be 3^3+2=29 digits long. so for numbers 0-9 on a 4 digit lock it will be 10^4+3=10003
bluecombats 2 months ago
For 3 digits I'm thinking:
111221131121231322232133323312
JayJamesDee 2 months ago
It would be good to find an algebraic expression for the next number in the sequence.
001BrainyBrady 2 months ago in playlist My Maths Videos
i solved the 3 digit one its kinda like a maze here inis 29 digits
11122233311332212131323123211
roflmoqkz1 2 months ago in playlist Uploaded videos
I got to 35 numbers for the 3-digit: 12312132111212211313311222323322333
MyrMagic 2 months ago
I'd solve it by making a program going through all the combinations by shifting just a digit each time.
Horinius 2 months ago
Hopefully the bedroom intruder never finds the sequence.
MrRyanDuba 2 months ago
What if the lock doesn't work like that?
darkdudironaji 2 months ago
Alright so, I spent about 3 hours on the thought that the triple 1's, 2's and 3's were separated from each other. Found out that is impossible. I need sleep now x_x
TehMathWiztard 2 months ago
meant 10003 below
qwert4327able 2 months ago in playlist My Maths Videos
I am going to conjecture that this lower bound is always achievable hence the general solution here is m^n+n-1 where n is the number of digits that can be entered chosen from m numbers. For his answer we had 4 numbers in a sequence and 10 choices giving 10^4+3=100003 as wanted. This is almost certainly the solution for every possible one and now just has to be proven that this is achievable which is gna be very hard.
qwert4327able 2 months ago in playlist My Maths Videos
Here is a general lower bound for n digits and m numbers (that may not be achievable). With n digits and m different numbers there are m^n possible combinations and to type in this many of ANY n digit numbers requires m^n+n-1 entries hence this is a lower bound. For example with 3 digits 3 numbers then 29 is a lower bound and any combination found which equals this will be the lowest combo. Given that someone above claimed they have done it in 18 numbers they must be wrong.
qwert4327able 2 months ago in playlist My Maths Videos
@qwert4327able I was just thinking that.
TehMathWiztard 2 months ago
π definitely pie!
PartiallyRibena 2 months ago
pie?
PartiallyRibena 2 months ago
well, now we all know how to hack people :D
Pizzscn 2 months ago
I spendt 5 min to find the kode for a door to the girls "dome" when i was in highschool.. ;)
same type of lock... ^^
qwerasdfAngel 2 months ago in playlist My Maths Videos
I love how enthusiastic you are!
saltymurder 2 months ago in playlist My Maths Videos
Comment removed
m71win 2 months ago
Comment removed
m71win 2 months ago
Finally, something that I can use the Sketch pad function on my iPad for.
anticorncob6 2 months ago
32333123131112113222332122133
Finally
Th1s1sMyAcc0untNam3 2 months ago
@imTHEcardMAGICmaster That's a bit childish isn't it.
singingbanana 2 months ago 31
This is the solution for 4 digits from 1 to 4:
1111211131114112211231124113211331134114211431144121213121412221223122412321233123412421243124413131413221323132413321333133413421343134414142214231424143214331434144214431444222232224223322342243224423232423332334234323442424332434244324443333433443434444111
The one for 5 digits doesn't fit in the comment section anymore. :P
GammahooX 2 months ago 2
Shortest possible for 3 digits (other solutions possible):
111 222 333 121 131 321 232 213 323 (11)
I entered the last 2 digits between brackets, because I see it as a cycle. If you start anywhere in this sequence (without the final two), make it to the end, start again from the beginning and then type the two first numbers again, you'll have all of them.
Why have I split it up in groups of three? Don't know yet, but I guess there'll be patterns in such a way.
Time for lunch...
wopaah 2 months ago
The number of digits of the sequence should be the number of combinations + Number of digits - 1.
So 2 digits is 5
3 digits is 29
4 digits it 259
HappyMemoryXD 2 months ago
Just a question: Is it possible to have 2 or more possible solutions?
PullarBearBear 2 months ago
@PullarBearBear yes there is more than one solution.
thepianoaddict 2 months ago
@PullarBearBear Yes, for instance when you have found a valid sequence then the reverse of the sequence is also valid.
isj4 2 months ago
Comment removed
HappyMemoryXD 2 months ago
Is this for 3 digits?
11121131221231321332223233311
HappyMemoryXD 2 months ago
wow! this is awesome, this could be used for hacking!
gecko77z 2 months ago
Nothing an infinite number of monkeys can't handle.
x246869 2 months ago
This is my solution. Ill try and make a better one maybe?
1112113112122131231321333232233122232
hi1hi2hi2 3 months ago
@hi1hi2hi2 Better one
21112312122331131321333232221
hi1hi2hi2 3 months ago
3 digits - 111222333112233123
4 digits - 1111222233334444111222333444112233441234
5 digits -111112222233333444445555511112222333344445555111222333444555112233445512345
Goldy1337 3 months ago
@Goldy1337 You've missed a few.
singingbanana 3 months ago 48
@singingbanana I just guessed. I figured there would be a few missing combinations.
I hated sequences and combinations in high school; it was my worst topic.
Goldy1337 3 months ago
@singingbanana A FEW?!!?!? HE MISSED TONS!
brianshrode72 1 week ago
@Goldy1337 lol fail
iamUSAn50 2 months ago in playlist My Maths Videos
@Goldy1337 132 missed in 3 1224 missed in 4 and 12354 missed in 5
yuitry1 2 months ago
@yuitry1 check out the last 5 digits for 5
vincentlcarter 1 month ago
Play the video then rapidly keep pressing the number 1 on your keyboard for a good laugh.
muffemod 3 months ago
3 digits: 211223313 4 digits: 21443424112233132 5 digits: 1121341552535451442433223 Check me Im pretty sure Im right
forrest0no 3 months ago
@forrest0no You need to contain combinations like 111 as well. I can see you've missed 121 as well...
singingbanana 3 months ago
@singingbanana I set it up in pairs, not triples, sorry for not clarifying :) ill try in triples and quadruples.
forrest0no 3 months ago
@singingbanana in fact here is one with triples
2: 11121122212 3:1112113112212321322231233313323
Im thinking that is right... Not sure...
forrest0no 3 months ago
@singingbanana I think he got 121 right at the beginning
Pizzscn 2 months ago
Comment removed
KyosBlog 2 months ago
This has been flagged as spam show
@Pizzscn still the sequence is not 29 digits long, which is the shortest solution you can come up with, and i guess he was referring to the lack of 121 and 111 in the 3 digit-sequence
KyosBlog 2 months ago
@forrest0no Think you're missing some combos like 111 and 222 and 333 in the first one etc...
muffemod 3 months ago
I got these answers:
11122233311332213121232313211 (29 digits)
1111444434442444144334432443144234422442144134412441143434243414333433243314323432243214313431243114242414233423242314223422242214213421242114141334132413141234122412141134112411133332333133223321331233113232313222322132123211313122312131123111222212211212111 (259 digits)
In general, for a combination of length N from K possible digits, the sequence length is (K^N)+N-1.
So:
(3^3)+3-1 = 29
(4^4)+4-1 = 259
(10^4)+4-1 = 10003
rtwvidz 3 months ago
Comment removed
rtwvidz 3 months ago
Comment removed
rtwvidz 3 months ago
@Zeldakitteh I'm getting a stack overflow, it's not just pure ram size. The problem might be with the deep recursion but I suspect it's actually the ArrayList which is probably not meant for such large lists. For more digits I'd write it in C++ without recursion and my own datatype. Properly optimised you could got to about 10 digits with 4GB of RAM.
GammahooX 3 months ago
I feel as if the strategy I would use is to list every combination and create a chain adding 1 number at a time and crossing off numbers as you go along. So the order would be starting with 1234, then doing a combo that includes 234X, then 34XY, then 4XYZ then XYZA and so on until you've crossed off every combo. Using this strategy on the 3 puzzle, I got an answer of:
311121131333122232213231233212
it solved itself (except I had 311 at the end which I easily stuck a 3 at the beginning).
Qwubs 3 months ago
@Qwubs Yeah I used a similar method, mine was:
11122233311332213121232313211
Everyvideo123 3 months ago
For three digit combination of three digits, I have
11223213322212313233312111311,
which was solved graphically (using a directed graph). Such a solution is prohibitive in the next cases (drawing 259 lines between 16 points...) so I'll be doing those differently. But now I have two data points (plus the other strings in the comments) to look at the properties of!
IhaveWoodforSheep 3 months ago
I could do it....but I just don't wanna.
GetMeThere1 3 months ago
more like winningbannana :) love the show!
hypock1 3 months ago
it is not possible after you get over 4 digits
magician2242 3 months ago
I made one of those locks back in my electronics course...it uses a 4017 IC, normally used for divisions and counters.
jowfofofo 3 months ago
Well, given m digits in an n digit combination, I can tell you that the shortest string will be m^n+(n-1). This is because you can drop (n-1) digits from every combination (of which there are m^n) save the last. As well, there are n digits in each of m^n combinations, so the number of digits is really n*m^n-(n-1)*(m^n-1), which is just m^n+(n-1).
But you already knew that. I'll have a solution to the problem later.
IhaveWoodforSheep 3 months ago
@singingbanana seriously dude, you're the first person to make math this interesting I've ever come across. Math education should start from solving *interesting* problems, and work backwards to let people figure out technique... and that's exactly what you're doing. I love it!
lekoman 3 months ago 4
Nooooo! it wasent your normal goodbye! "So if you have been..Thanks for watching!"
Contrabot 3 months ago
Finally found a solution for the 3 digit problem using just pen and paper (no brute force methods here). 11121222323331312311332213211
wzrds3 3 months ago
(0+1+2+3+4+5+6+7+8+9)^4=4100625
excepto94 3 months ago
@excepto94 what is this? the possible combinations are 4^9, if you just write them down after one another you get 4^10 digits, which is about a fourth of your solution even without any optimization, while the optimum length should be way shorter.
KyosBlog 3 months ago
@KyosBlog didn't think through it, thought of the handshaking problem and (don't know the English term for X^Y) to the number of well... numbers, but I didn't even thought I was right.
excepto94 3 months ago
My solution to opening the door? Sledgehammer.
IAintMadXBL 3 months ago 5
My solution: 23213132313311122233322112123
MorallyDepraved 3 months ago
how are you that smart
messi78910 3 months ago
29 is the shortest string for 3 digits.
My solution:
31112113122123132133222323331
4 digit solution will be 112 digits long I believe.
V1per41 3 months ago
aww, you didn't say "If you have been, thanks for watching"
There is a misnomer in your description. You are asking us to solve a 2 digit sequence with 2 total digits, a 3 digit sequence with only 3 digits, and a 4 digit sequence with only 4 digits. But the lock doesn't use a 10 digit sequence. Why not ask us to figure out a 2 digit sequence with 3 digits, 3 with 5, 4 with 7. That would get us to practice for the real problem. Just my thoughts.
redmatrix 3 months ago 6
@redmatrix I could have done. You're right, there is a slight difference between the problems.
singingbanana 3 months ago
rakib567 3 months ago
@rakib567 Where is 0000?
supergreatsuper 3 months ago
11121131221231321332223233311 - 29 Digits (one of the shortest possible ones).
GammahooX 3 months ago
Comment removed
redmatrix 3 months ago
I wrote an algorithm that solved the problem with all 10 digits and a 4 digit code with a 10029 digit solution. Only 26 to go!
Butt4cak3 3 months ago
@Butt4cak3 Ooh, so why wasn't it the 10003 digit solution? Tell me about it.
singingbanana 3 months ago
@singingbanana It was the first time I tested it. With some optimization I could get the 10003 solution as well. I'm going to try it later. If you want to see it yourself, I can upload to a webserver and private message you the link ;D
Butt4cak3 3 months ago
@Butt4cak3 Hm, I wrote one in like 20 lines of java code that always finds the shortest solution for all digit ranges (0-9 in this case) and lengths (4 in this case). :P
GammahooX 3 months ago
@GammahooX Excellent stuff. By the way, I'll be giving you a pen and paper solution - although a little intense when you have to write out a 10003 digit solution using pen and paper, which I did.
singingbanana 3 months ago
@singingbanana Well it starts getting hard above 4 digits (with 0-9) on the PC aswell. My simple and relatively fast way to solve it can not solve the problem for 5 digits due to memory limitations. However it would be possible to implement it in a more memory efficient, more complex and maybe slower way in C++.
My code can be found here: pastebin[.]com/bGdNwrUB
GammahooX 3 months ago
@GammahooX Is the memory limitation Java's 64 MB or the computers RAM (one or more GB usually)?
Zeldakitteh 3 months ago
for 4 numbers its either 28 or 29 i think :/
MrCDRipped 3 months ago
My 3 - digit sequence:
31231321223311211133323222131
With 29 digits I think it's the shortest possible way.
Since you get a new 3-digit combination by adding 1 digit to a 3 digit combination and I need 27 different 3-digit combinations I took 3 random digits and added 26 more to have the 27 different possibilities. Making an answer with 29-digits the shortest possible answer.
I hope people can understand my explanation. if you don't you can just ask me and I'll try too explain it better.
xKargatx 3 months ago
By the way @singingbanana do you know Project Euler? It's all about solving little math problems and it's pretty fun and addictive!
MaThWa92 3 months ago
@MaThWa92 I know of it. I haven't taken part yet.
singingbanana 3 months ago
@MaThWa92 That's exactly what I thought of when I saw this problem
V1per41 3 months ago
12221112123332232313311312 i'm missing 132, 231 and 321. but everything I try, breaks everything else.
LewisAM37 3 months ago
21312313311223233321113222121
111RockNRoll111 3 months ago
1337
razerburst 3 months ago
Take the sequence for every combination of four numbers, and repeat the pattern for solving for the 1234 combination, but then 2345, 3456, .... After that, 1235, skipping any four consecutive without a 5, and so on, then 1236, 1237, 1238, 1239, 1230, 1245,6,7,1256,7,8, and so on, until 6890.
khzhak 3 months ago
Is this a hobbit?
macaw2000 3 months ago
1234567891112123123412345123461657158181654861567479462518979165748974654198465418974654898997898125632132518616546515666485321654654841864116824ILUMINATI2165187448718312341234512346165715818165486156747946251897916574897465419846541897465489899789812563213251
alfa00xx 3 months ago
@alfa00xx I see what you did there!
MegaCakewalker 3 months ago
@alfa00xx not a single 0
wizzboy5000000000000 3 months ago
001101122122332334434455455665667767788788998
?
o0ocrizo0o 3 months ago
21222321113233131231121333221
IrkIr 3 months ago
12312132321222111313322333112 for 1-3, I'll to 4 later if it's still unsolved
bobdole1988 3 months ago
you can do it on 24 digits
monsimand 3 months ago
1*2*3*4
monsimand 3 months ago
If you feel like giving us a real treat why dont you solve this for a code of N length, with K possible digits :)
orcyngiser 3 months ago 15
@orcyngiser I will show you how in the response!
singingbanana 3 months ago 13
@orcyngiser Use Eulerian path to solve this problem seeing possible digits as nodes and combinations as paths, you would get De Bruijn sequence(s) with B(N, K) = K^N digits, then because the property of the cyclic group, you need another (N-1) attached to the end, in this case it is 10^4+4-1 = 10003, I feel like cheating since I am a math grad student...until I took an arrow in the knee.
Jonsoncao 3 months ago
@Jonsoncao y u no talk in english? :)
orcyngiser 2 months ago
For 3: 11122131232223311333231321211. That's 29 digits. :P
ipadkeyboard13 3 months ago
Comment removed
NeoLeo37 3 months ago
Comment removed
siriuscord 3 months ago
@NeoLeo37 except it's a 3-digit combination, that uses the numbers 1, 2 and 3. it'd be right is it was a 2 digit combination though
siriuscord 3 months ago
I know how to get into the lock easily its the same type of lock that is on the door to the office where i work, in a charity shop! If you simply put a number in and turn and keep the dial turned click C (cancel) and then if you hear a click its a number(repeat 0-9), The lock you showed is very simple and actually works on a down or not idea, basically you can put the four numbers in ANY order and click the letter X, Y or Z
I know its not the mathematical solve that you wanted but its a solution
alewisgb 3 months ago
for the 4 digit one is it 24?
MrCDRipped 3 months ago
@MrCDRipped It's longer than that. Don't forget it has to contain things like 1111, 2222 etc as well.
singingbanana 3 months ago
on the 123 lock, given that there are (I think) 27 possible combos, am I right in saying that the correct sequence would be (3 + 26) = 29 digits long?
111RockNRoll111 3 months ago
@111RockNRoll111 I don't think I'm spoiling to much by saying it is 29 digits long. And there are many ways to solve it.
singingbanana 3 months ago
@111RockNRoll111 Yes you are correct now actually work it out like the rest of us :P
kitkatchunky93 3 months ago
@kitkatchunky93 I dont think Ive got enough paper in the house after all these failed attempts!
I wonder if there is a formula....
111RockNRoll111 3 months ago
@111RockNRoll111 Haha! Now you're thinking like a mathematician...
singingbanana 3 months ago
There are multiple answers. The process of finding an answer is very simple.
First write all states that are possible - 10k in this case. Now draw an arrow from each state to the one that would be obtained by adding a digit to it. For example, from state 1234 draw arrows to 2340, 2341...2349. After this, find a path that covers all states exactly once. There are multiple such paths and each corresponds to an answer.
Length of the solution is number of states + length of combination - 1 = 1003
sid2089 3 months ago 3
@sid2089 So you've turned this question into an excercise in graph theory. That's a great idea I would've never had. Is there an simple algorithm for finding the traversal of an oriented graph without visiting a vertex twice? Otherwise I might just use backtracking to find a solution.
inscept 3 months ago
IS THE door already open?
MrCDRipped 3 months ago
I believe for 1-3 it's: 11121131221231321332322233311
But I think I'll need more then my Post-it note to work out 1-4.
And with finals coming up I think I'll leave it up to some daring
puzzler with more time on their hands. Good Luck
Nightmare2u 3 months ago
1112223332211213132123113313232312
323,321,132,313,132 occur twice : /
type:
3-grams "1112223332211213132123113313232312"
into wolfram alpha
to check it.
rerere284 3 months ago
so far, I have 000010002000300040005000600070008000900, but after that it gets a bit tricky. If i put another 0 down, I would repeat something no matter what I put after it. I believe it should be a 1, but then unsure as to where to go from there.
siriuscord 3 months ago
I have discovered the sequence, together with a truly marvelous proof that it's the best solution, which this textfield is too small to contain.
treegraph 3 months ago
@treegraph Haha, nice one. :D
GammahooX 3 months ago
C4, thats my number.
jinanwow 3 months ago
12221313322311233312132111323212 that's my guess >_< ... 32 digits :D
ZeldaGirl35 3 months ago
The shortest sequence for the 3-digit 1-3 lock is 29 digits long and for the 4-digit 1-4 lock is 259 digits long. I don't think I'll be posting the latter sequence today.
wzrds3 3 months ago
@wzrds3 yeah I think for 3-digit 1-3 lock is 29 digits long ^_^ , I got 32 digits though :/
ZeldaGirl35 3 months ago
WHAT?
Mrcheesefaceful 3 months ago
Such sequences are called De Bruijn sequences. I believe the minimum length of a sequence of "m" digits of length "n" is m^n, but i completely forgot how to determine the exact sequence. It's been a while since I read about this.
lzrdking5 3 months ago in playlist Uploaded videos
11121131221231321332223233311 allows for all 27 possible combinations of the 3 digits
kitkatchunky93 3 months ago 2
@kitkatchunky93 I think this is right :D , great job ^_^
ZeldaGirl35 3 months ago
For 3 digit sequence, there are 27 possible combinations right? :p
ZeldaGirl35 3 months ago
@ZeldaGirl35 There are 27 combinations, so 27x3=81 digits all together - but there is a sequence that is much shorter but still contains all possible 3-digit combinations.
singingbanana 3 months ago
@singingbanana 11121131221231321332223233311 allows for all 27 possible combinations of the 3 digits
kitkatchunky93 3 months ago
this is for the 4 digit combination using digits 0 to 9
i got it i think. count up from 0000 to 9999. and just place each number next to the previous.
0000 0001 0002 0003 0004... 9995 9996 9997 9998 9999
i put spaces in just to help you see the numbers.this is just going through every combination... lol but it works i think. take a long time to do it this way.
i believe this works but... it is inefficient. numbers will be repeated doing it like this
mdogboy0 3 months ago
@mdogboy0 Exactly, the shortest solution has 10003 digits, so you're way off at the moment.
singingbanana 3 months ago