Extreme primes: Difference between revisions
→{{header|Wren}}: More info on task plus tweaks to code.
(Added Wren (with serious reservations)) |
(→{{header|Wren}}: More info on task plus tweaks to code.) |
||
Line 53:
{{libheader|Wren-math}}
{{libheader|Wren-fmt}}
This is very similar to the [[Prime numbers p for which the sum of primes less than or equal to p is prime]] task which itself was a near duplicate of the [[Summarize primes]] task so I'm highly dubious about converting it to a separate draft task. I also found it at [[oeis:A013918|OEIS-A013918]] though it doesn't appear to have a recognized name.
<syntaxhighlight lang="ecmascript">import "./math" for Int
import "./fmt" for Fmt
var primes = Int.primeSieve(
var extremes = [2]
var sum = 2
for (p in primes.skip(1)) {
sum = sum + p
if (Int.isPrime(sum)) {
extremes.add(sum)
if (extremes.count ==
}
}
|