33333334 1111111155555556
found by
100 dim H(30)
200
300 gosub *AddOne(1)
400
500 end
600
700 *AddOne(Lvl)
710 local I
800 if Lvl=1 then St=1:else St=H(Lvl-1)
900 for I=St to 6
1000 Tot=Tot+I
1100 Num=Num*10+I
1200
1300 H(Lvl)=I
1400 Sr=int(sqrt(Tot)+0.5)
1500 if Sr*Sr=Tot then
1600 :Num2=Num*Num
1700 :if Num2<999999999999999999999999999999999999 then
1800 :N$=cutspc(str(Num))
1900 :N2$=cutspc(str(Num2))
2000 :if len(N2$)=2*len(N$) then
2100 :Tot2=0
2200 :Good=1
2300 :for J=1 to len(N2$)
2400 :Tot2=Tot2+val(mid(N2$,J,1))
2500 :if J>1 then if mid(N2$,J,1)<mid(N2$,J-1,1) then Good=0:endif:endif
2600 :next
2700 :if Good then
2800 :Sr=int(sqrt(Tot2)+0.5)
2900 :if Sr*Sr=Tot2 then
3000 :print Num,Num2
3100 :endif
3200 :endif
3300 :endif
3400 :endif
3500 :endif
3600 if Lvl<18 then gosub *AddOne(Lvl+1)
3700
3800 Num=Num\10
3900 Tot=Tot-I
4000 next I
4100 return
Enigma No. 1523, "Dicey numbers", by Susan Denham,
New Scientist, 6 December 2008, page 48. |