66 lines
1.6 KiB
Text
66 lines
1.6 KiB
Text
import isprime
|
|
|
|
maxi = 1000035
|
|
cu = 0
|
|
c2 = 0
|
|
c3 = 0
|
|
c4 = 0
|
|
c5 = 0
|
|
p = 0
|
|
dim unsexy(10), pairs(5), trips(5), quads(5), quins(5)
|
|
|
|
for n = maxi to 2 step -1
|
|
if isPrime(n) then
|
|
p = p + 1
|
|
if not isPrime(n - 6) and not isPrime(n + 6) then
|
|
if cu < 10 unsexy(cu) = n
|
|
cu = cu + 1
|
|
fi
|
|
if isPrime(n - 6) then
|
|
if c2 < 5 pairs(c2) = n
|
|
c2 = c2 + 1
|
|
if isPrime(n - 12) then
|
|
if c3 < 5 trips(c3) = n
|
|
c3 = c3 + 1
|
|
if isPrime(n - 18) then
|
|
if c4 < 5 quads(c4) = n
|
|
c4 = c4 + 1
|
|
if isPrime(n - 24) then
|
|
if c5 < 5 quins(c5) = n
|
|
c5 = c5 + 1
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
next n
|
|
|
|
print p, " primes less than ", maxi
|
|
|
|
print chr$(10), c2, " pairs ending with:"
|
|
for i = 4 to 0 step -1
|
|
print " [", pairs(i)-6, ", ", pairs(i), "]"
|
|
next i
|
|
|
|
print chr$(10), c3, " triplets ending with:"
|
|
for i = 4 to 0 step -1
|
|
print " [", trips(i)-12, ", ", trips(i)-6, ", ", trips(i), "]"
|
|
next i
|
|
|
|
print chr$(10), c4, " quadruplets ending with:"
|
|
for i = 4 to 0 step -1
|
|
print " [", quads(i)-18, ", ", quads(i)-12, ", ", quads(i)-6, ", ", quads(i), "]"
|
|
next i
|
|
|
|
print chr$(10), c5, " quintuplet(s) ending with:"
|
|
if c5 > 5 then i = 5 else i = c5 : fi
|
|
for i = i-1 to 0 step -1
|
|
print " [", quins(i)-24, ", ", quins(i)-18, ", ", quins(i)-12, ", ", quins(i)-6, ", ", quins(i), "]"
|
|
next i
|
|
|
|
print chr$(10), cu, " unsexy primes ending with:"
|
|
for i = 9 to 0 step -1
|
|
print unsexy(i), ",";
|
|
next i
|
|
print chr$(8)," "
|
|
end
|