CalmoSoft primes: Difference between revisions

Content added Content deleted
m (→‎{{header|Julia}}: maked incorrect)
Line 730: Line 730:


=={{header|Julia}}==
=={{header|Julia}}==
{{incorrect|Julia|I think you want [i..i+5] not [1..i+5]}}
<syntaxhighlight lang="julia">using Primes
<syntaxhighlight lang="julia">using Primes


Line 741: Line 740:
") of primes less than $N totals ", sum(pri[i:i+window_size]))
") of primes less than $N totals ", sum(pri[i:i+window_size]))
if window_size > 24
if window_size > 24
println(string(pri[1:i+5])[begin:end-1], ", ... ",
println(string(pri[i:i+5])[begin:end-1], ", ... ",
string(pri[i-6+window_size:i+window_size])[begin+1:end], "\n")
string(pri[i-5+window_size:i+window_size])[begin+1:end], "\n")
else
else
println("The sequence is: ", pri[i:i+window_size], "\n")
println("The sequence is: ", pri[i:i+window_size], "\n")
Line 756: Line 755:
</syntaxhighlight>{{out}}
</syntaxhighlight>{{out}}
<pre>
<pre>

Longest Calmo prime seq (length 21) of primes less than 100 totals 953
Longest Calmo prime seq (length 21) of primes less than 100 totals 953
The sequence is: [7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89]
The sequence is: [7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89]


Longest Calmo prime seq (length 3001117) of primes less than 50000000 totals 72618848632313
Longest Calmo prime seq (length 3001117) of primes less than 50000000 totals 72618848632313
[2, 3, 5, 7, 11, 13, 17, 19, 23, ... 49999693, 49999699, 49999711, 49999739, 49999751, 49999753, 49999757]
[7, 11, 13, 17, 19, 23, ... 49999699, 49999711, 49999739, 49999751, 49999753, 49999757]
</pre>
</pre>