dim Factors(3) C = 0 N = 2 * 3 * 5 print "Sphenic numbers less than 1,000:" do if Sphenic(N) then C = C + 1 if N < 1000 then print N using "####"; if mod(C, 15) = 0 print fi if C = 2e5 then print "The 200,000th sphenic number is ", N, " = "; for I = 0 to 2 print Factors(I); if I < 2 print " * "; next I print fi fi N = N + 1 if N >= 1e6 break loop print "There are ", C, " sphenic numbers less than 1,000,000" C = 0 N = 2 * 3 * 5 print "\nSphenic triplets less than 10,000:" do if Sphenic(N) and Sphenic(N+1) and Sphenic(N+2) then C = C + 1 if N < 10000 then print "[", N, ", ", N+1, ", ", N+2, "]"; if mod(C, 3) = 0 then print else print ", "; : fi fi if C = 5000 print "The 5000th sphenic triplet is [", N, ", ", N+1, ", ", N+2, "]" fi N = N + 1 if N+2 >= 1e6 break loop print "There are ", C, " sphenic triplets less than 1,000,000" print peek("millisrunning") / 1000, "sec." end sub Sphenic(N) local C, F, L, Q L = sqr(N) C = 0 F = 2 do Q = N / F if mod(N, F) = 0 then Factors(C) = F C = C + 1 if C > 3 return false N = Q if mod(N, F) = 0 return false if F > N break else F = F + 1 if F > L then Factors(C) = N C = C + 1 break fi fi loop return (C = 3) end sub