Circular primes: Difference between revisions
Content added Content deleted
Line 616: | Line 616: | ||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |
||
This task uses [http://www.rosettacode.org/wiki/Repunit_primes#F.23 rUnitP] |
This task uses [http://www.rosettacode.org/wiki/Repunit_primes#F.23 rUnitP] and [http://www.rosettacode.org/wiki/Extensible_prime_generator#The_functions Extensible Prime Generator (F#)] |
||
<lang fsharp> |
<lang fsharp> |
||
// Circular primes - Nigel Galloway: September 13th., 2021 |
// Circular primes - Nigel Galloway: September 13th., 2021 |
||
Line 623: | Line 623: | ||
let circP()=seq{yield! [2;3;5;7]; yield! fN [1;3;7;9] 10} |
let circP()=seq{yield! [2;3;5;7]; yield! fN [1;3;7;9] 10} |
||
circP()|> Seq.take 19 |>Seq.iter(printf "%d "); printfn "" |
circP()|> Seq.take 19 |>Seq.iter(printf "%d "); printfn "" |
||
let isPrimeI g=Open.Numeric.Primes.MillerRabin.IsProbablePrime(&g) |
|||
printf "The first 5 repunit primes are "; rUnitP 10|>Seq.take 5|>Seq.iter(fun n->printf $"R(%d{n}) "); printfn "" |
printf "The first 5 repunit primes are "; rUnitP 10|>Seq.take 5|>Seq.iter(fun n->printf $"R(%d{n}) "); printfn "" |
||
</lang> |
</lang> |