Solve the following alphametic multiplication puzzle, where each of the small letters denotes a different base ten digit from 0 to 9. However, each asterisk represents a base ten digit from 0 to 9, whether same or different. None of the numbers can contain any leading zero.
* * * * * *
* *
----------------
* * * * * *
* * * * * *
---------------
o c t o b r e
where each of octo, cto, ctob, to, tobr, tobre, obre, bre, br, re and e is a prime number.
112979
87
-------
790853
903832
-------
9829173
based on
list
10 for A=100000 to 999999
20 for B1=1 to 9
30 I2=B1*A:if I2>999999 then cancel for:goto 170
40 for B2=1 to 9
50 I1=B2*A:if I1>999999 then cancel for:goto 160
60 Prod=A*(B1*10+B2)
70 if Prod>1000000 and Prod<9999999 then
71 :S=cutspc(str(Prod))
72 :if mid(S,1,1)=mid(S,4,1) then
90 :if prmdiv(val(left(S,4)))=val(left(S,4)) then
100 :if prmdiv(val(mid(S,2,3)))=val(mid(S,2,3)) then
110 :if prmdiv(val(mid(S,2,4)))=val(mid(S,2,4)) then
120 :if prmdiv(val(mid(S,3,2)))=val(mid(S,3,2)) then
130 :if prmdiv(val(mid(S,3,4)))=val(mid(S,3,4)) then
140 :if prmdiv(val(mid(S,3,5)))=val(mid(S,3,5)) then
150 :if prmdiv(val(mid(S,4,4)))=val(mid(S,4,4)) then
151 :if prmdiv(val(mid(S,5,3)))=val(mid(S,5,3)) then
152 :if prmdiv(val(mid(S,5,2)))=val(mid(S,5,2)) then
153 :if prmdiv(val(mid(S,6,2)))=val(mid(S,6,2)) then
154 :if prmdiv(val(mid(S,7,1)))=val(mid(S,7,1)) then
155 :print A:print B1;B2:print I1:print I2:print Prod:print
159 next
160 next
170 next A
OK
run
112979
8 7
790853
903832
9829173
OK
|
Posted by Charlie
on 2010-02-20 15:49:47 |