Fill a 9x9 grid with only the digits 1 to 9.
- Each row and column should comprise of three 3-digit primes.
- In each of the second, fifth and eighth rows and in each of the the second, fifth and eighth columns, the three 3-digit primes, in SuDoDu fashion, every digit 1 to 9 will be used once.
- In all other rows and columns digits may be repeated.
- All 3-digit primes should be distinct.
More than one solution may exist.
As part of my computer exploration, one program I wrote keeps a table of the 3-digit primes, and looks for sets of three of these such that no digit in any one of them appears in any of the others. However, I find that in each such set, at least one of the numbers has a given digit repeated, and another has a digit zero, resulting in at least two of the digits 1 thru 9 not appearing at all. The sets of three primes found were:
127 499 503
167 499 503
181 499 503
211 499 503
223 599 601
223 599 607
227 499 503
227 599 601
233 599 601
233 599 607
271 499 503
277 499 503
277 599 601
281 499 503
283 599 601
283 599 607
337 599 601
347 599 601
373 599 601
383 599 601
383 599 607
433 599 601
433 599 607
443 599 601
443 599 607
487 599 601
The program is:
5 dim Prim(150),Used(150)
10 N=nxtprm(99)
20 loop
30 print N;
38 I=I+1:Prim(I)=cutspc(str(N))
40 N=nxtprm(N)
60 if N>999 then goto 80
70 endloop
80 MaxSub=I
100 for I=1 to MaxSub
110 for J=I+1 to MaxSub
130 Good=1
140 for Psn=1 to len(Prim(J))
150 if instr(Prim(I),mid(Prim(J),Psn,1)) then Good=0
160 next
170 if Good then
190 :for K=J+1 to MaxSub
200 :for Psn=1 to len(Prim(K))
210 :if instr(Prim(I)+Prim(J),mid(Prim(K),Psn,1)) then Good=0:endif
220 :next
230 :if Good then print Prim(I);" ";Prim(J);" ";Prim(K):endif
240 :next
260 next
270 next
Edited on June 4, 2007, 4:02 pm
|
Posted by Charlie
on 2007-06-04 15:40:31 |