1 REM https://rosettacode.org/wiki/Casting_out_nines 10 LET b = 10 20 FOR k = 1 TO (b ^ 2) - 1 30 LET c1 = c1 + 1 40 IF k MOD (b - 1) <> (k * k) MOD (b - 1) THEN 70 50 LET c2 = c2 + 1 60 PRINT k; " "; 70 REM endif 80 NEXT k 90 PRINT 100 PRINT "trying "; c2; " numbers instead of "; c1; " numbers saves "; 100 - (100 * c2 / c1); "%"
Return to Example Index