CalmoSoft primes: Difference between revisions
→{{header|Wren}}: Incorporates two optimizations (see Talk Page) - about 20% faster than before.
(→{{header|Wren}}: Incorporates two optimizations (see Talk Page) - about 20% faster than before.) |
|||
Line 1,014:
{{libheader|Wren-math}}
{{libheader|Wren-fmt}}
This runs in about
<syntaxhighlight lang="ecmascript">import "./math" for Int, Nums
import "./fmt"for Fmt
Line 1,031:
if (pc - i < longest) break
if (i > 0) sum = sum - primes[i-1]
var isEven = (i == 0)
var sum2 = sum
for (j in pc-1..i) {
var temp = j - i + 1
if (temp < longest) break
if (j < pc - 1) sum2 = sum2 - primes[j+1]
if (
if (Int.isPrime2(sum2)) {
if (temp > longest) {
longest = temp
|