In the following alphametic equation each capital letter in bold represents a different base x digit from 0 to x-1. None of the numbers can contain any leading zero.
PRIME + PRIME + PRIME = NUMBER
Determine the minimum positive integer value of x such that PRIME is a prime number.
Bonus Question:
What would have been the minimum positive integer value of x, if each capital letter in bold represented a different base x prime digit from 2 to x-1?
Similar to what I used for part 1, but with added requirement:
10 dim Psn(20)
100 dim Used(100)
190 kill "goldbach.txt"
200 open "goldbach.txt" for output as #2
300 cls
400 for X=8 to 45
500 Psn(1)=1
600 for J=2 to 6
700 Psn(J)=Psn(J-1)*X
800 next
900 :for P=2 to X-1:if prmdiv(P)=P then
1000 :Used(P)=1
1100 :for N=2 to X-1:if prmdiv(N)=N then
1200 :if Used(N)=0 then
1300 :Used(N)=1
1400 :for R=2 to X-1:if prmdiv(R)=R then
1500 :if Used(R)=0 then
1600 :Used(R)=1
1700 :for I=2 to X-1:if prmdiv(I)=I then
1800 :if Used(I)=0 then
1900 :Used(I)=1
2000 :for M=2 to X-1:if prmdiv(M)=M then
2100 :if Used(M)=0 then
2200 :Used(M)=1
2300 :for E=2 to X-1:if prmdiv(E)=E then
2400 :if Used(E)=0 then
2500 :Used(E)=1
2600 :Prime=P*Psn(5)+R*Psn(4)+I*Psn(3)+M*Psn(2)+E
2700 :for U=2 to X-1:if prmdiv(U)=U then
2800 :if Used(U)=0 then
2900 :Used(U)=1
3000 :for B=2 to X-1:if prmdiv(B)=B then
3100 :if Used(B)=0 then
3200 :Used(B)=1
3300 :Number=N*Psn(6)+U*Psn(5)+M*Psn(4)+B*Psn(3)+E*Psn(2)+R
3400 :if 3*Prime=Number and prmdiv(Prime)=Prime then
3500 :print X,P;R;I;M;E,N;U;M;B;E;R,Prime;Number
3600 :print #2,X,P;R;I;M;E,N;U;M;B;E;R,Prime;Number
3700 :endif
3800 :Used(B)=0:endif
3900 :endif
4000 :next
4100 :Used(U)=0:endif
4200 :endif
4300 :next
4400 :Used(E)=0:endif
4500 :endif
4600 :next
4700 :Used(M)=0:endif
4800 :endif
4900 :next
5000 :Used(I)=0:endif
5100 :endif
5200 :next
5300 :Used(R)=0:endif
5400 :endif
5500 :next
5600 :Used(N)=0:endif
5700 :endif
5800 :next
5900 :Used(P)=0:endif
6000 :next
6100 :next
6200 :close
6300
checked up to base 45 and didn't find any answers.
|
Posted by Charlie
on 2009-06-11 16:03:12 |