I have in front of me five standard dice, touching in a row, left to right.
Treating each face as a base-10 digit with the value of its number of pips, the five dice, on their faces that are toward me, form a 5-digit prime. The tops of the dice, also taken in order, form a 5-digit perfect square.
If I were looking at these five dice from the opposite direction, I'd see a different prime number formed by the digits on the vertical faces in order, and I'd see a different perfect square formed by the tops, again taken in order, as seen. In fact, that perfect square would be larger than the one I'm seeing from the side I'm actually on.
And one more thing: the five digits of each prime are different, but of course any given digit might or might not be on both primes.
1. Identify the primes and squares involved.
2. If duplicate digits (any multiples of the same digit within a number) were allowed, what could the front and back primes be, and the resulting squares on top, other than the ones found in part 1, using the same other rules as part 1?
|
Submitted by Charlie
|
Rating: 4.0000 (1 votes)
|
|
Solution:
|
(Hide)
|
I'm seeing 43651 on the front facing me, with 12544 as the square on top.
The prime on back is 62143, and the square that's the reverse of the first is 44521.
The program does not check for duplicate digits within the primes and so also reports the part 2 solution: 43411 as the original prime and 66343 on back, with the squares on top the same as in the first solution.
5 cls
10 for Sr=100 to 316
20 Sq=cutspc(str(Sr*Sr))
30 Sqrev=""
40 Good=1
50 for I=1 to 5
60 Sqrev=mid(Sq,I,1)+Sqrev
70 if instr("0789",mid(Sq,I,1))>0 then Good=0
80 next I
90 Sq2=val(Sqrev)
100 Sr2=int(sqrt(abs(Sq2))+0.5)
110 if Sr2*Sr2=Sq2 and Good=1 and Sq2>val(Sq) then
210 :for T1=1 to 6
220 :if T1<>val(mid(Sq,1,1)) and T1<>7-val(mid(Sq,1,1)) then
230 :for T2=1 to 6
240 :if T2<>val(mid(Sq,2,1)) and T2<>7-val(mid(Sq,2,1)) then
250 :for T3=1 to 6
260 :if T3<>val(mid(Sq,3,1)) and T3<>7-val(mid(Sq,3,1)) then
270 :for T4=1 to 6
280 :if T4<>val(mid(Sq,4,1)) and T4<>7-val(mid(Sq,4,1)) then
290 :for T5=1 to 6
300 :if T5<>val(mid(Sq,5,1)) and T5<>7-val(mid(Sq,5,1)) then
310 :Pr1s=cutspc(str(T1))+cutspc(str(T2))+cutspc(str(T3))+cutspc(
str(T4))+cutspc(str(T5))
320 :Pr2s=cutspc(str(7-T5))+cutspc(str(7-T4))+cutspc(str(7-T3))+c
utspc(str(7-T2))+cutspc(str(7-T1))
330 :Pr1=val(Pr1s):Pr2=val(Pr2s)
340 :if prmdiv(Pr1)=Pr1 and prmdiv(Pr2)=Pr2 then
350 :print Pr2:print Sq2:print Sq:print Pr1:print
360 :endif
370 :endif
380 :next T5
390 :endif
400 :next T4
410 :endif
420 :next T3
430 :endif
440 :next T2
450 :endif
460 :next T1
920 :endif
930 next Sr
|