Circular primes: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: %v <--> %V) |
|||
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] |
|||
<lang fsharp> |
<lang fsharp> |
||
// Circular primes - Nigel Galloway: September 13th., 2021 |
// Circular primes - Nigel Galloway: September 13th., 2021 |
||
Line 623: | Line 624: | ||
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) |
let isPrimeI g=Open.Numeric.Primes.MillerRabin.IsProbablePrime(&g) |
||
printf "The first 5 repunit primes are "; |
printf "The first 5 repunit primes are "; rUnitP 10|>Seq.take 5|>Seq.iter(fun n->printf $"R(%d{n}) "); printfn "" |
||
</lang> |
</lang> |
||
{{out}} |
{{out}} |
||
Line 630: | Line 631: | ||
The first 5 repunit primes are R(2) R(19) R(23) R(317) R(1031) |
The first 5 repunit primes are R(2) R(19) R(23) R(317) R(1031) |
||
</pre> |
</pre> |
||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
Unfortunately Factor's miller-rabin test or bignums aren't quite up to the task of finding the next four circular prime repunits in a reasonable time. It takes ~90 seconds to check R(7)-R(1031). |
Unfortunately Factor's miller-rabin test or bignums aren't quite up to the task of finding the next four circular prime repunits in a reasonable time. It takes ~90 seconds to check R(7)-R(1031). |