Jump to content

Circular primes: Difference between revisions

m (→‎{{header|Phix}}: %v <--> %V)
Line 616:
 
=={{header|F_Sharp|F#}}==
This task uses [http://www.rosettacode.org/wiki/Repunit_primes#F.23 rUnitP]
<lang fsharp>
// Circular primes - Nigel Galloway: September 13th., 2021
Line 623 ⟶ 624:
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 "; Seq.initInfinite((+)1)|>Seq.filter(funrUnitP n->isPrimeI((10I**n-1I)/9I))10|>Seq.take 5|>Seq.iter(fun n->printf $"R(%d{n}) "); printfn ""
</lang>
{{out}}
Line 630 ⟶ 631:
The first 5 repunit primes are R(2) R(19) R(23) R(317) R(1031)
</pre>
 
=={{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).
2,172

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.