list
10 for N=4444 to 55999
20 Ns=cutspc(str(N))
22 Num1=5-len(Ns)
30 Good=1:Rct=0
40 for I=1 to len(Ns)-1
50 if instr(mid(Ns,I+1,*),mid(Ns,I,1))>0 then Rct=Rct+1
60 next
70 if Rct>1 or Rct=1 and len(Ns)=4 or left(Ns,1)<"4" then Good=0
72 if len(Ns)=4 or Rct=1 then Num1=Num1+1
73 if left(Ns,1)="4" then Num1=Num1+1
74 if mid(Ns,2,1)="4" then Num1=Num1+1
80 if Good=0 then goto *Notthis
90 if mid(Ns,2,1)<>"4" and mid(Ns,2,1)<>"5" then Good=0
95 if mid(Ns,1,1)<mid(Ns,2,1) then Good=0
100 if mid(Ns,3,1)<mid(Ns,2,1) then Good=0
110 if mid(Ns,4,1)<mid(Ns,2,1) then Good=0
120 if len(Ns)=5 then if mid(Ns,5,1)<mid(Ns,2,1) then Good=0
130 Ok1=0
140 if N @ 4=0 then if prmdiv(N//4)=N//4 then Ok1=1:Num1=Num1+1
150 if N @ 5=0 then if prmdiv(N//5)=N//5 then Ok1=1
160 if Good=1 then Good=Ok1
170 N2=0
180 for I=len(Ns) to 1 step -1
190 N2=N2*10+val(mid(Ns,I,1))
200 next
210 Pct=0:Prevd=0
220 while N2>1
230 D=prmdiv(N2):N2=N2//D:if Prevd=D then Good=0
240 Pct=Pct+1:Prevd=D
250 wend
260 if Pct<4 or Pct>5 then Good=0
261 if Pct=4 then Num1=Num1+1
280 if Good then print N,Num1
299 *Notthis
300 next N
OK
run
5468 5
54476 4
OK
shows that, of the two numbers that satisfy all the items, 5468 uses the 4 in 5 of the first 6 items and 54476 uses the 4 in 4. If the latter were the answer, then the 4 in the 7th clue would be correct and make the total 5, but then it would revert to 4, etc. ad infinitum, being a paradox, so that can't be the answer.
The answer is thus 5468, and the 4 is correct in 5 of the clues, leading to no paradox in the final clue.
From Enigma No. 1609, "I remember it well", by Susan Denham, New Scientist, 21 August 2010, page 26.
|