Problems & Puzzles: Puzzles

Puzzle 161. A Secret Code

Sudipta Das poses the following puzzle:

I have written a code in which each of the digits 0 through 9 represents some other digit.

Let N be the number of perfect square integers below 10^x, which when decoded , result in primes.

Example:

Code: 0123456789 -> 2548719603

Perfect Squares below 1000 that the above Code turn them prime numbers when decoded:

Before decoding {0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 169, 256, 625, 729, 784}

After decoding {2, 5, 7, 3,  59, 41, 89, 73,  97, 02, 593, 419, 941, 643, 607}

then for this code N=15


What is the code if :

1) N is to be maximum? 
2) N is to be minimum? 

Solve 1 & 2 for x = 3 , 4 & 5


Solution:

Shyam Sunder Gupta found (17/12/01) the following solutions:

"I have found many solutions to the puzzle. For given conditions i.e. if all the digits are different in code than in original 0123456789 , then the following solutions are obtained.

(1) For X=3 :
Maximum N= 19 , The codes can be any of the following: 1356947820, 8260719453, 2960147853, 1960247853.
Minimum N=0, Since there are many codes possible , I am giving only one as a sample: 9875642310.
(2) For X=4:
Maximum N= 44 , The codes can be any of the following: 5346189027, 2386901457.
Minimum N=0, Since there are many codes possible , I am giving only one as a sample: 9875624310
(3) For X=5:
Maximum N= 97 , The codes can be any of the following: 4358921067, 4385961027.
Minimum N=0, Since there are many codes possible , I am giving only one as a sample: 8697025314

If we relax the condition of all different digits in code than in original 0123456789, than though minimum N remains zero, but maximum value  increases as given below:

(1) X=3:
Maximum N= 20 , The codes can be any of the 14 solutions. I am giving only four: 5104923867, 4960217583, 4306157829, 2356147809
(2) X=4:
Maximum N= 45 , The code is 2106743859
(3) X=5:
Maximum N= 101, The code is 4180763529

***

I have asked to Shyam to describe his methods.

*** 

This is his answer:

Fundamental logic involved is that a perfect square can end in only 0,1,4,5,6 and 9( 0 and 5 are less frequent) and can never end in 2,3,7 or 8. Similarly Prime No. can never end in 0,4,6 or 8 but ends in only 1,3,7,9. Also except 2 and 5(single digit) , no other number can end in 2 or 5. So, obviously for MAXIMUM N , code should be such that 2,3 ,7 ,8 are replaced by 0,4,6,8 in code and also1,4,6,9 shall be replaced by 1,3,7,9 with different permutations and combinations.

Similarly for MINIMUM N, 1,4,6,9 shall be replaced by 0,4,6,8 and 2,3,7,8 shall be replaced by 1,3,7,9. Putting additional conditions as given in Puzzle , a computer program was made and solutions as communicated were obtained.

***

 



Records   |  Conjectures  |  Problems  |  Puzzles