base = 10
for k = 1 to base * base - 1
   c1 += 1
   if k mod (base - 1) = (k * k) mod (base - 1)
      c2 += 1
      write k & " "
   .
.
print ""
print "Trying " & c2 & " numbers instead of " & c1 & " numbers saves " & 100 - 100 * c2 / c1
