Following are seven odd primes where each distinct digit (0 to 9) was substituted with a corresponding distinct letter in all the given numbers. None of the following numbers begin with a leading zero.
THREE
FIVE
SEVEN
ELEVEN
THIRTEEN
SEVENTEEN
NINETEEN
If you can, identify the corresponding digit for each letter.
48533
2903
13037
363037
48954337
130374337
79734337
from
10 dim Taken(9)
100 :for T=1 to 9
200 :Taken(T)=1
300 :
400 :for F=1 to 9
500 :if Taken(F)=0 then
600 :Taken(F)=1
700 :
800 :for S=1 to 9
900 :if Taken(S)=0 then
1000 :Taken(S)=1
1100 :
1200 :for E=1 to 9
1300 :if Taken(E)=0 then
1400 :Taken(E)=1
1500 :
1600 :for N=1 to 9
1700 :if Taken(N)=0 then
1800 :Taken(N)=1
1900 :
2000 :for H=0 to 9
2100 :if Taken(H)=0 then
2200 :Taken(H)=1
2300 :
2400 :for I=0 to 9
2500 :if Taken(I)=0 then
2600 :Taken(I)=1
2700 :
2800 :for V=0 to 9
2900 :if Taken(V)=0 then
3000 :Taken(V)=1
3100 :
3200 :for R=0 to 9
3300 :if Taken(R)=0 then
3400 :Taken(R)=1
3500 :
3600 :for L=0 to 9
3700 :if Taken(L)=0 then
3800 :Taken(L)=1
3900 :
4000 :Three=T*10000+H*1000+R*100+E*11
4100 :Five=F*1000+I*100+V*10+E
4200 :if prmdiv(Three)=Three and prmdiv(Five)=Five then
4300 :Seven=S*10000+E*1010+V*100+N
4400 :Eleven=E*101010+L*10000+V*100+N
4500 :if prmdiv(Seven)=Seven and prmdiv(Eleven)=Eleven then
4600 :Thirteen=T*10001000+H*1000000+I*100000+R*10000+E*110+N
4700 :Seventeen=S*100000000+E*10100110+V*1000000+N*10001+T*1000
4800 :if prmdiv(Seventeen)=Seventeen and prmdiv(Thirteen)=Thirteen then
4900 :Nineteen=N*10100001+I*1000000+E*10110+T*1000
5000 :if prmdiv(Nineteen)=Nineteen then
5100 :print:print Three:print Five:print Seven:print Eleven
5110 :print Thirteen:print Seventeen:print Nineteen
5200 :endif
5300 :endif
5400 :endif
5500 :endif
5600 :
5700 :Taken(L)=0
5800 :endif
5900 :next
6000 :
6100 :Taken(R)=0
6200 :endif
6300 :next
6400 :
6500 :Taken(V)=0
6600 :endif
6700 :next
6800 :
6900 :Taken(I)=0
7000 :endif
7100 :next
7200 :
7300 :Taken(H)=0
7400 :endif
7500 :next
7600 :
7700 :Taken(N)=0
7800 :endif
7900 :next
8000 :
8100 :Taken(E)=0
8200 :endif
8300 :next
8400 :
8500 :Taken(S)=0
8600 :endif
8700 :next
8800 :
8900 :Taken(F)=0
9000 :endif
9100 :next
9200 :
9300 :Taken(T)=0
9400 :next
Edited on October 20, 2007, 7:43 pm
|
Posted by Charlie
on 2007-10-20 19:40:58 |