Function revn(n As ULongInt, nd As ULongInt) As ULongInt Dim As ULongInt r For i As UInteger = 1 To nd r = r * 10 + n Mod 10 n = n \ 10 Next i Return r End Function Dim As UInteger nd = 2, count, lim = 90, n = 20 Do n += 1 Dim As ULongInt r = revn(n,nd) If r < n Then Dim As ULongInt s = n + r, d = n - r If nd And 1 Then If d Mod 1089 <> 0 Then GoTo jump Else If s Mod 121 <> 0 Then GoTo jump End If If Frac(Sqr(s)) = 0 And Frac(Sqr(d)) = 0 Then count += 1 Print count; ": "; n If count = 5 Then Exit Do : End If End If End If jump: If n = lim Then lim = lim * 10 nd += 1 n = (lim \ 9) * 2 End If Loop Print Print "Done" Sleep