RosettaCodeData/Task/Factorial-primes/BASIC256/factorial-primes.basic
2023-07-01 13:44:08 -04:00

20 lines
400 B
Text

include "isprime.kbs"
include "factorial.kbs"
print "First 10 factorial primes:"
found = 0
i = 1
while found < 9
fct = factorial (i)
if isprime(fct-1) then
found += 1
print rjust(string(found),2); ": "; rjust(string(i),2); "! - 1 = "; fct-1
end if
if isprime(fct+1) then
found += 1
print rjust(string(found),2); ": "; rjust(string(i),2); "! + 1 = "; fct+1
end if
i += 1
end while
end