Prime numbers p for which the sum of primes less than or equal to p is prime: Difference between revisions
Prime numbers p for which the sum of primes less than or equal to p is prime (view source)
Revision as of 17:04, 8 July 2021
, 2 years agoRealize in F#
(→{{header|ALGOL 68}}: Remove extraneous blank line) |
(Realize in F#) |
||
Line 85:
</pre>
=={{header|F_Sharp|F#}}==
This task uses [http://www.rosettacode.org/wiki/Extensible_prime_generator#The_functions Extensible Prime Generator (F#)]
<lang fsharp>
// Primes (+)2..p is prime. Nigel Galloway: July 7th., 2021
primes32()|>Seq.takeWhile((>)1000)|>Seq.scan(fun(n,_) g->(n+g,g))(0,0)|>Seq.filter(fun(n,_)->isPrime n)|>Seq.iter(fun(_,n)->printf "%d " n); printfn ""
</lang>
=={{header|Factor}}==
{{works with|Factor|0.99 2021-06-02}}
|