RosettaCodeData/Task/Casting-out-nines/Craft-Basic/casting-out-nines.basic

19 lines
282 B
Plaintext

precision 4
define base = 10, c1 = 0, c2 = 0
for k = 1 to (base ^ 2) - 1
let c1 = c1 + 1
if k % (base - 1) = (k * k) % (base - 1) then
let c2 = c2 + 1
print k
endif
next k
print "trying ", c2, " numbers instead of ", c1, " numbers saves ", 100 - (100 * c2 / c1), "%"