Ezt a posztot angolul írom, mert legtöbben a Channel 9 honlapról idetévedve fogják elolvasni. Remélem.
I’m writing this in English because most people reading this don’t speak Hungarian. Well at least I hope they will be reading this. [Post updated; corrected typos; beware of mutant quotation marks when copying code;]
The number 4 Hard Hat challenge was to solve what these numbers meant. I first tried some Optical Character Recognition software (OneNote and Office Document Imaging as well as some others from the OCR Wikipedia page) to rip the numbers from the image. Epic fail. How do spammers break captchas damnit?! So I did it the manual way. Here you go:
string TheNumber = "2973853263233233753482843823642933243283" + "6434928432937228939232737732732535234532" + "9335283373377282333349287338349365335325" + "3283443783243263673762933373883363333472" + "8936639338428833535236433333237634438833" + "3275387394324354374325383293375366284282" + "3323383643473233852922933873933663333833" + "9228632439434936334633337636632933333428" + "9285333384346333346365364364365365336367" + "2873353883543533683523253893663653393433" + "8837733538538437838338536338232536832634" + "8284348375376338372376377364368392352393" + "3883393733943693253343433882852753933822" + "7533337432433532332332328232332332932432" + "3323323323323336323333323323323327323324" + "2873323253233233233892792792792792792792" + "7934232332332332332332332733432333832336" + "9344372376326339329376282344";
Of course I tried solving it with Visual C# Express. (I am right into Project Euler also.) I tried like converting the numbers to binary and converting it to text by charactercode. Fail. I noticed that there were no 0s or 1s. So I subtracted 2 from all values, tried base-10 and base-2 int-to-char conversion. Still fail. Gave up. That was late last night, Budapest time GMT+1.
I looked at the Channel 9 today wondering if anyone has solved it yet. Nope. But. Judah has posted some interesting statistics. I’ll highlight what really is important.
Here are some interesting stats from the cipher they flashed on the screen:
There are 708 characters in the cipher, excluding new line characters.
Given a chunk size of 3 characters,
- There are 236 chunks.
- There are 172 duplicates.
- All the characters are numbers between 2 and 9.
- The 323 code shows up a whopping total of 29 times!
- The 333 code shows up 11 times.
- All other codes show up 7 times or less.
- 35 chunks start with a 2.
- 200 chunks start with a 3. (Interesting!)
- 1 chunk starts with a 4.
- Despite the cipher containing 2s, 3s, 4s, 5s, 6s, 7s, 8s, and 9s, chunks only start with 2 and 3, except the 1 chunk that starts with 4.
- There are no 0s.
- There are no 1s.
- There are 115 2s.
- There are 293 3s.
- There are 56 4s.
- There are 38 5s.
- There are 49 6s.
- There are 52 7s.
- There are 63 8s.
- There are 42 9s.
The 323 code is very interesting indeed. I’m leaning towards chunk sizes of 3 being involved somehow. We’ll see!
And that made me think. No 0s or 1s. 3-char blocks. Hmmm. That sounds like octal numbers (base-8). I already subtracted 2 from all values yesterday, I just didn’t know what to do next. So I’ve generated 3-character blocks that were perfect octal numbers. Cool. Now I generated characters from them. Thoroughly uncool. The ‘question’ what Mike Swanson was talking about is nowhere to be seen. Just random text. Wait, no. I don’t have any stupid unicodish error characters like I had when converting to text from base-10 or base-2 numbers. OK, maybe cool. Anyway, here’s what I got.
=sDAAkV2pb9BFbW2Gh7xEmECXSGK1im0IW5NWcKCFRnBDel9MvLIU7dyr6KXbIHlRvI+uzBZjCq9kd20HNbUAs89uydIqx4BzWaTIldGIJ73IrTITcbbccLe5KvZYfXCwdcOQvmKsrnqsapCfDV2VklNhlmbfxXyvOizgCJQv3+yp+IjBKAAA0AAGBAAAAALAIAAAEAB5HCAAAw///////PAAAAAAEJANAgRhlDOGl0R
Does that look like base64 text? Yes it does. Cool. Now I google base64 encoder. I found this. I Decode the text. Uncool again. I got nothing. (!) Oh, I know. The ‘=’ sign at the beginning. That should be at the end. So I grab Visual C# once again and reverse the base64 string. Result:
R0lGODlhRgANAJEAAAAAAP///////wAAACH5BAEAAAIALAAAAABGAA0AAAKBjI+py+3vQJCgziOvyXxfbmlhNlkV2VDfCpasqnrsKmvQOcdwCXfYZvK5eLccbbcTITrI37JIGdlITaWzB4xqIdyu98sAUbNH02dk9qCjZBzu+IvRlHIbXK6ryd7UILvM9leDBnRFCKcWN5WI0mi1KGSXCEmEx7hG2WbFB9bp2VkAADs=
I decode it on the same site as before. Does it look cool? Nope, here is what I got:
GIF89aF�
�‘�����ÿÿÿÿÿÿ���!ù���,����F�
��Œ©Ëíï@ Î#¯É|_nia6YÙPß
–¬ªzì*kÐ9Çp wØfò¹x·m·!:Èß²HÙHM¥³Œj!Ü®÷Ë�Q³GÓgdö £dîø‹Ñ”r®«ÉÞÔ »ÌöWƒtE§7•ˆÒhµ(d—I„ǸFÙfÅÖéÙY��;
I don’t like unicodeish characters. Wait. It starts with “GIF”. Hey. It must be a base64-encoded GIF image. How do you do bas64-endoded images? Wikipedia is your friend. I copy-paste it into my own online html editor, I change the mime type to image/gif and the data to my data…
<html> <head> <title>Cím</title> </head> <body> <img src="data:image/gif;base64,R0lGODlhRgANAJEAAAAAAP///////wAAACH5BAEAAAIALAAAAABGAA0AAAKBjI+py+3vQJCgziOvyXxfbmlhNlkV2VDfCpasqnrsKmvQOcdwCXfYZvK5eLccbbcTITrI37JIGdlITaWzB4xqIdyu98sAUbNH02dk9qCjZBzu+IvRlHIbXK6ryd7UILvM9leDBnRFCKcWN5WI0mi1KGSXCEmEx7hG2WbFB9bp2VkAADs=" alt="something" /> </body> </html>
…and…
Victory. Here is what I got:
The answer is more than 200 hundred. I wish I could be there in October. Well, I hope I at least get that T-shirt. Anyway, solving this was fun. And I feel cool. I might as well say 1337. If anyone is interested here’s the only code I used in C#.
string TheNumber = "2973853263233233753482843823642933243283" + "6434928432937228939232737732732535234532" + "9335283373377282333349287338349365335325" + "3283443783243263673762933373883363333472" + "8936639338428833535236433333237634438833" + "3275387394324354374325383293375366284282" + "3323383643473233852922933873933663333833" + "9228632439434936334633337636632933333428" + "9285333384346333346365364364365365336367" + "2873353883543533683523253893663653393433" + "8837733538538437838338536338232536832634" + "8284348375376338372376377364368392352393" + "3883393733943693253343433882852753933822" + "7533337432433532332332328232332332932432" + "3323323323323336323333323323323327323324" + "2873323253233233233892792792792792792792" + "7934232332332332332332332733432333832336" + "9344372376326339329376282344"; /*string Binary = ""; for (int i = 0; i < TheNumber.Length; i++) { int Value = Int32.Parse(TheNumber.Substring(i, 1)); Binary += (Value % 2).ToString(); } for (int i = 0; i < Binary.Length - 8; i += 8) { Console.Write(Convert.ToChar(Convert.ToInt64(Binary.Substring(i, 8), 2))); }*/ /*string NewNumber = ""; for (int i = 0; i < TheNumber.Length; i++) { int Value = Int32.Parse(TheNumber.Substring(i, 1)); //if (Value % 3 == 0) NewNumber += (Value).ToString(); //else // NewNumber += Value.ToString(); }*/ /*for (int i = 0; i <= NewNumber.Length - 2; i += 3) { Console.Write(Convert.ToChar(Int32.Parse(NewNumber.Substring(i, 3)) % 0x100)); }*/ List<string> Blocks = new List<string>(); for (int i = 0; i <= TheNumber.Length - 2; i += 3) { Blocks.Add(TheNumber.Substring(i, 3)); } for (int i = 0; i < Blocks.Count; i++) { Blocks[i] = Blocks[i].Replace('2', '0'); Blocks[i] = Blocks[i].Replace('3', '1'); Blocks[i] = Blocks[i].Replace('4', '2'); Blocks[i] = Blocks[i].Replace('5', '3'); Blocks[i] = Blocks[i].Replace('6', '4'); Blocks[i] = Blocks[i].Replace('7', '5'); Blocks[i] = Blocks[i].Replace('8', '6'); Blocks[i] = Blocks[i].Replace('9', '7'); } string Base64 = ""; for (int i = 0; i < Blocks.Count; i++) { Base64 += (Convert.ToChar(Convert.ToInt64(Blocks[i], 8))); } Console.WriteLine(Base64); string Base64reverse=""; for (int i = Base64.Length - 1; i >= 0; i--) { Base64reverse += Base64[i]; } Console.WriteLine(Base64reverse); Console.ReadLine();
Boldizsar,
Congratulations, man! You deserve more than a free t-shirt.
Fantastic! I’m very impressed. You definitely deserve your shirt! 🙂
My mom also said that MSFT should at least hire me as CEO. Or something like that. 😀
Great job! Wow! I don’t know how you did it, but its just amazing.
először is hatalmas grat. aztán még1 😀
+ megmutatod majd a pólódat ha megérkezett?:D
Köszi szépen!
Persze, majd megmutatom, épp most kaptam meg az e-mailt, hogy amint tudják feladják postára de várni kell majd rá. 😀
Good job! Not only in way of thinking but also in using Judah’s observations.
Although I do not share your mom’s idea in full (I suggest to accept the best technical job, not the best marketing one), I feel also cool as being Hungarian. ..and also for some other personal reasons.
Congratulations! My best wishes for your future.
Boldizsar,
Going to try out the new PDC hard hat challenge? Here it is on StackOverflow:
http://stackoverflow.com/questions/118794/whats-the-answer-to-this-microsoft-pdc-challenge
I don’t really have that much time to solve this stuff now that school has started. I might check it on the weekend. Maybe. Anyway, thanks for reminding me 🙂