The Mysterious Code

Logic Level 4

You wake up in a locked cell, a bit shaken up but with all faculties intact. When you get to the cell-door you see a Number Pad with an attached note that has the following instructions...

"I am Professor Mad Math. I have imprisoned you! The only way to escape is to punch in the correct Code into the Number Pad. The 10 10 digit Code is made up of digits 0 9 0-9 inclusive, each digit used exactly once. These are the clues to crack my Code---

  1. The sum of the middle two digits is a Square Number.

  2. The sum of the middle four digits is a Cube number

  3. The net difference between the first and tenth digit is 2 2

  4. The net difference between the second and ninth digit is 3 3

  5. The net difference between the third and eighth digit is 4 4

  6. The sum of the first five digits is a Prime number

  7. The sum of the last five digits is a Triangular number

  8. The sum of the digits in odd positions (first, third, fifth, seventh and ninth digits) is an Odd number

  9. The digit 4 4 is somewhere in the first five positions

I believe I have given you more than adequate information. Can you crack the Code?"


The answer is 7342105869.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Sean Sullivan
Jul 22, 2015

Throughout this solution I will use the notation (a,b,c) with any number of elements within parentheses to represent all possible permutations of those numbers

Starting with the same method as Satyen:

The sum of the digits 0 9 0-9 is 45 45 . The only combination of Prime and >Triangular numbers that works is 17 17 and 28 28 . One of the first five numerals is 4 4 . So the sum of the other four digits is 13 13 . The only possible combos for first five and last five digits are

( 0 , 1 , 3 , 4 , 9 ) ( 2 , 5 , 6 , 7 , 8 ) (0,1,3,4,9)(2,5, 6 ,7, 8) ,

( 0 , 2 , 3 , 4 , 8 ) ( 1 , 5 , 6 , 7 , 9 ) (0, 2, 3, 4, 8) (1 ,5 ,6 ,7 ,9) ,

( 0 , 1 , 4 , 5 , 7 ) ( 2 , 3 , 6 , 8 , 9 ) (0, 1, 4, 5, 7) (2, 3, 6, 8, 9) ,

( 1 , 2 , 3 , 4 , 7 ) ( 0 , 5 , 6 , 8 , 9 ) (1, 2, 3, 4, 7)(0, 5, 6, 8, 9) ,

( 0 , 2 , 4 , 5 , 6 ) ( 1 , 3 , 7 , 8 , 9 ) (0,2, 4, 5, 6)(1, 3, 7, 8, 9)

The square number can be 1 , 4 , 9 , 16 1, 4, 9, 16 however, if it is 9 9 then adding the next two digits will not make it big enough to be the next cube 27 27 so 9 9 is out, the square must be 1 , 4 , 16 1, 4, 16 and the cube will be 8 8 if the square is 1 , 4 1, 4 and 27 27 if the square is 16 16 .

Take the last case ( 0 , 2 , 4 , 5 , 6 ) ( 1 , 3 , 7 , 8 , 9 ) (0,2, 4, 5, 6)(1, 3, 7, 8, 9) :

The only possible square is 1 1 so the cube is 8 8 and we have ( 2 , 5 , 6 ) 4013 ( 7 , 8 , 9 ) (2,5,6)4013(7,8,9) . Clues 3 , 4 3,4 and 5 5 tell us that each number on the left must be 2 , 3 2,3 or 4 4 away from a number on the right, 2 2 on the left is not, we have a contradiction and this entire case is thrown out.

Note that if the square is 4 4 then we have either 0 , 4 0,4 or 1 , 3 1,3 in the middle and as the cube must be 8 8 , we use the digits 0 , 1 , 3 0,1,3 and 4 4 in the 4 4 middle spots. For each case left, 3 3 of these digits are part of the left most 5 5 and so the square can't be 4 4 . For similar reasons, if the square is made of 0 0 and 1 1 , then the cube must add either 2 2 and 5 5 or 3 3 and 4 4 but we just established that in the remaining cases 0 , 1 , 3 , 4 0,1,3,4 cannot be in the middle in any order. This means the three possible combinations of middle 4 4 digits are 0 , 1 , 2 , 5 0,1,2,5 if the square is 1 1 and 7 , 9 , 3 , 8 7,9,3,8 or 7 , 9 , 5 , 6 7,9,5,6 if the square is 16 16

In the first case we must have ( 0 , 1 , 4 ) 3978 ( 2 , 5 , 6 ) (0,1,4)3978(2,5,6) , the only two that are 4 4 apart are 1 1 and 5 5 so we have ( 0 , 4 ) 3978 ( 2 , 6 ) (0,4)3978(2,6) but now none are 3 3 apart so this case is out

Case 2 2 we have ( 3 , 4 , 8 ) 2015 ( 6 , 7 , 9 ) (3,4,8)2015(6,7,9) the only two that are 4 4 apart are 3 3 and 7 7 so we have ( 4 , 8 ) 320157 ( 6 , 9 ) (4,8)320157(6,9) but now none are 3 3 apart so this case is also out

Taking case 3 3 ( 0 , 1 , 4 ) 5796 ( 2 , 3 , 8 ) (0,1,4)5796(2,3,8) the only two that are 4 4 apart are 4 4 and 8 8 so we have ( 0 , 1 ) 457968 ( 2 , 3 ) (0,1)457968(2,3) however choosing the only digits 3 3 apart, 0 0 and 3 3 for the next digits out, leaves us with digits only 1 1 aprat when they must be 2 2 .

We now know the number must have the form ( 1 , 2 , 3 , 4 , 7 ) ( 0 , 5 , 6 , 8 , 9 ) (1, 2, 3, 4, 7)(0, 5, 6, 8, 9) giving two options:

( 1 , 2 , 4 ) 3798 ( 0 , 5 , 6 ) ( 1 , 4 ) 237986 ( 0 , 5 ) (1,2,4)3798(0,5,6) \rightarrow (1,4)237986(0,5) because if we choose 1 , 5 1,5 as the two digits 4 4 apart we have only even digits left, none of which could have difference 3 3 , however even with the case chosen, no pairs have difference 3 3 so this subcase is out.

( 3 , 4 , 7 ) 2105 ( 6 , 8 , 9 ) ( 3 , 7 ) 421058 ( 6 , 9 ) 7342105869 (3, 4, 7)2105(6, 8, 9) \rightarrow (3, 7)421058(6, 9) \rightarrow 7342105869

Adding up the odd digits of 7342105869 7342105869 we have 7 + 4 + 1 + 5 + 6 = 23 7+4+1+5+6=23 which is odd so the answer is 7342105869 \boxed{7342105869}

Drowning in the casework for this solution, if there is a way to limit it please lemme know!

The hint that the sum of the digits in odd positions is odd is apparently not needed. (I also did not use it, basically following your approach, but in a different order).

Tom Verhoeff - 4 years, 5 months ago
Hung Woei Neoh
Jul 3, 2016

With these questions, I tend to pick every single possible option that leads to a dead end, before finally getting the correct answer...

Anyway, I have a different approach. We begin with the first two clues. From there, we can shortlist the possible options:

Sum of middle two digits: 1 , 4 , 9 , 16 1,4,9,16 (No two distinct digits will give you a sum more than 17)

Sum of middle four digits: 8 , 27 8,27 (No four distinct digits will give you a sum less than 6 or more than 30)

If sum of squares is 9 9 , we cannot get 27 27 because the maximum sum of those digits is 26 26 . Therefore, we have only three possible cases (time for a case by case analysis!):

(Perfect square, perfect cube) = ( 1 , 8 ) , ( 4 , 8 ) , ( 16 , 27 ) =(1,8),(4,8),(16,27)

Note: We try to fit all the numbers first in these cases, the arrangement will be decided later


Case 1 : ( 16 , 27 ) (16,27)

To get a 16 16 , our only possible option is 7 + 9 7+9 . Our number will then be

79 \square\square\square\square79\square\square\square\square

The two digits beside 7 7 and 9 9 will need to add up to 11 11 . We have these possibilities: 5 + 6 , 3 + 8 \color{#3D99F6}{5+6},\;\color{#D61F06}{3+8}

First, we try 5 \color{#3D99F6}{5} and 6 \color{#3D99F6}{6}

579 6 \square\square\square\color{#3D99F6}{5}79\color{#3D99F6}{6}\square\square\square

We are left with 0 , 1 , 2 , 3 , 4 , 8 0,1,2,3,4,8 . To satisfy clues 3, 4 and 5, 8 8 must go with 4 4 to get a difference of 4 4 . 3 3 must then go with 0 0 to get a difference of 3 3 , but that leaves us with 2 2 and 1 1 . We cannot satisfy clues 3, 4 and 5, so this option is impossible.

We then try 3 \color{#D61F06}{3} and 8 \color{#D61F06}{8} :

379 8 \square\square\square\color{#D61F06}{3}79\color{#D61F06}{8}\square\square\square

We are left with 0 , 1 , 2 , 4 , 5 , 6 0,1,2,4,5,6 . To satisfy clue 5, we have 3 options:

  1. 6 6 and 2 2 has a difference of 4 4 . However, with 0 , 1 , 4 , 5 0,1,4,5 remaining, we cannot satisfy clues 3 and 4
  2. 5 5 and 1 1 has a difference of 4 4 . However, with 0 , 2 , 4 , 6 0,2,4,6 remaining, we cannot satisfy clues 3 and 4
  3. 4 4 and 0 0 has a difference of 4 4 . However, with 1 , 2 , 5 , 6 1,2,5,6 remaining, we cannot satisfy clues 3 and 4

This implies that Case 1 is impossible. We then move on to the next case


Case 2 : ( 4 , 8 ) (4,8)

To get a sum of 4 4 , we have only two options: 4 + 0 , 3 + 1 \color{#20A900}{4+0},\;\color{#EC7300}{3+1}

Note that to get an 8 8 , we have to get 4 + 4 4+4 . This implies that 4 , 0 , 3 , 1 \color{#20A900}{4,0},\color{#EC7300}{3,1} are all in the center, and we have only two possibilities. Let's try out the first one:

4 13 0 \square\square\square\color{#20A900}{4}\color{#EC7300}{13}\color{#20A900}{0}\square\square\square

We are left with 2 , 5 , 6 , 7 , 8 , 9 2,5,6,7,8,9 . To satisfy clues 3, 4 and 5, 2 2 must go with 5 5 or 6 6 . If 2 2 goes with 5 5 , the remaining digits 6 , 7 , 8 , 9 6,7,8,9 cannot satisfy clue 5. If 2 2 goes with 6 6 to satisfy clue 5, 5 5 and 8 8 will satisfy clue 4, and 7 7 and 9 9 will satisfy clue 3. We then have

752 4 13 0689 752\color{#20A900}{4}\color{#EC7300}{13}\color{#20A900}{0}689

Next, we check to see if it satisfies clues 6 and 7.

Note that adding 5 distinct digits will give a minimum of 10 and a maximum of 35. The triangular numbers between 10 and 35 inclusive are 10 , 15 , 21 , 28 10,15,21,28 . The sum of all 10 10 digits is 45 45 , and these are the possible combinations:

( 10 , 35 ) , ( 15 , 30 ) , ( 21 , 24 ) , ( 28 , 17 ) (10,35),(15,30),(21,24),\color{#27D2E7}{(28,17)}

Among these possible combinations, only ( 28 , 17 ) \color{#27D2E7}{(28,17)} satisfies clues 6 and 7.

Now, we return to our number:

752 4 13 0689 752\color{#20A900}{4}\color{#EC7300}{13}\color{#20A900}{0}689

The sum of the first 5 5 digits is 19 19 . We cannot move 4 4 as it needs to satisfy clue 9. The other digits in the first half are all the smaller digits, therefore we know that we cannot satisfy clues 6 and 7 with this combination.

Note that the second possibility:

1 40 3 \square\square\square\color{#EC7300}{1}\color{#20A900}{40}\color{#EC7300}{3}\square\square\square

will also lead to the same dead end as above. We can then be certain that Case 3 is the only possible option


Case 3 : ( 1 , 8 ) (1,8)

The two middle numbers must be 0 0 and 1 1 :

01 \square\square\square\square01\square\square\square\square

To get an 8 8 , the two digits beside 0 0 and 1 1 must add up to 7 7 . We have two possibilities: 4 + 3 , 2 + 5 \color{#69047E}{4+3},\;\color{magenta}{2+5}

Note that the first possibility

401 3 \square\square\square\color{#69047E}{4}01\color{#69047E}{3}\square\square\square

will lead to the same dead end we got in Case 2. This implies that the only option we have is

201 5 \square\square\square\color{magenta}{2}01\color{magenta}{5}\square\square\square

We are now left with 3 , 4 , 6 , 7 , 8 , 9 3,4,6,7,8,9 . To satisfy clue 5, we have 2 options:

  1. 3 3 and 7 7 has a difference of 4 4 . However, with 4 , 6 , 8 , 9 4,6,8,9 remaining, we cannot satisfy clues 3 and 4
  2. 4 4 and 8 8 has a difference of 4 4 . 3 3 and 6 6 satisfies clue 4, and 7 7 and 9 9 satisfies clue 3.

Put it in the number:

734 201 5869 734\color{magenta}{2}01\color{magenta}{5}869

Now, we check and see if it satisfies clues 6 6 and 7 7 :

From case 2, we know that the first 5 5 digits must add up to 17 \color{#27D2E7}{17} , and the last 5 5 digits must add up to 28 \color{#27D2E7}{28}

The first 5 5 digits add up to 16 16 , and we have only one way to change this to 17 17 : switch the middle numbers

734 210 5869 734\color{magenta}{2}10\color{magenta}{5}869

4 4 is in the first half, and clue 9 is satisfied. We are left with clue 8:

Sum of digits in odd positions = 7 + 4 + 1 + 5 + 6 = 23 =7+4+1+5+6=23 . The sum is an odd number, which satisfies the final clue.


Punch in the code 7342105869 \boxed{7342105869} , and run towards your freedom!

Satyen Nabar
Jul 18, 2015

The sum of the digits 0 9 0-9 is 45 45 . The only combination of Prime and Triangular numbers that works is 17 17 and 28 28 .

One of the first five numerals is 4 4 . So the sum of the other four digits is 13 13 .

The only possible combos for first five and last five digits is--

49013 , 25678 49013, 25678 ,

48023 , 15679 48023, 15679 ,

47015 , 23689 47015, 23689 ,

47123 , 05689 47123, 05689 ,

46025 , 13789 46025, 13789 .

It is extremely unlikely that 9 9 is in the first five digits.

The Cube number can only be 8 8 or 27 27 and the square number can be 1 , 4 , 9 , 16 1, 4, 9, 16 .

Combining the information about difference between digits as provided and sum of odd positions being odd, the only Code that works is 7342105869 7342105869

Just want to ask if clue 8 is really necessary, because all other possibilities have been eliminated before there is even a chance to use it.

Saya Suka - 4 years, 6 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...