base = 10 c1 = 0 c2 = 0 for k = 1 to (base ^ 2) - 1 c1 = c1 + 1 if k mod (base - 1) = (k * k) mod (base - 1) then c2 = c2 + 1: print k; " "; next k print print "Trying "; using("##", c2); " numbers instead of "; using("###", c1); " numbers saves "; using("##.##", (100 - (100 * c2 / c1))); "%" end