The six 3-digit numbers, and their prime factorizations are:
178 2 * 89
187 11 * 17
718 2 * 359
781 11 * 71
817 19 * 43
871 13 * 67
list
5 dim Used(9)
10 for D1=1 to 9
20 Used(D1)=1
30 for D2=1 to 9
40 if Used(D2)=0 then
50 :Used(D2)=1
60 :for D3=1 to 9
70 :if Used(D3)=0 then
80 :Used(D3)=1
90 :if fnOk(100*D1+10*D2+D3) then
100 :if fnOk(100*D1+10*D3+D2) then
110 :if fnOk(100*D2+10*D1+D3) then
120 :if fnOk(100*D2+10*D3+D1) then
130 :if fnOk(100*D3+10*D1+D2) then
140 :if fnOk(100*D3+10*D2+D1) then
150 :print D1;D2;D3,
151 :Q=100*D1+10*D2+D3
152 :print prmdiv(Q);prmdiv(Q//prmdiv(Q))
160 :endif
170 :endif
180 :endif
190 :endif
200 :endif
210 :endif
220 :Used(D3)=0
230 :endif
240 :next
250 :Used(D2)=0
260 :endif
270 next D2
280 Used(D1)=0
290 next D1
300 end
400 fnOk(X)
410 if prmdiv(X)=X then return(0)
420 N=X//prmdiv(X)
430 if prmdiv(N)=N then return(-1)
440 return(0)
OK
run
1 7 8 2 89
1 8 7 11 17
7 1 8 2 359
7 8 1 11 71
8 1 7 19 43
8 7 1 13 67
OK
Based on Enigma No. 1552, "Prime products", by Richard England, New Scientist, 4 July 2009, page 24. |