View or download nextPrimeTest.frink in plain text format
// Tests the nextPrime[n] function
for a=2^31 - million to 2^31+million
{
np = nextPrime[a]
if (np != oldNextPrime[a])
println["Error at $a"]
if (a mod 100000 == 0)
print["$a "]
}
oldNextPrime[n] :=
{
if (n mod 2 == 0)
n = n - 1
do
{
n = n + 2
} while (! isPrime[n])
return n
}
View or download nextPrimeTest.frink in plain text format
This is a program written in the programming language Frink.
For more information, view the Frink
Documentation or see More Sample Frink Programs.
Alan Eliasen was born 18864 days, 11 hours, 23 minutes ago.