Repunit primes: Difference between revisions
→{{header|Wren}}: Using a more efficient method to calculate repunit strings, a bit quicker overall.
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: oops) |
(→{{header|Wren}}: Using a more efficient method to calculate repunit strings, a bit quicker overall.) |
||
Line 284:
An embedded program so we can use GMP as I know from experience that Wren-CLI (using BigInt) will not be able to complete this task in a reasonable time.
Still takes a while - 11 minutes
<lang ecmascript>/* repunit_primes.wren */
Line 290:
import "./math" for Int
import "./fmt" for Fmt
import "./str" for Str
var limit = 2700
Line 297 ⟶ 298:
var rPrimes = []
for (p in primes) {
var s = Mpz.fromStr(Str.repeat("1"
if (s.probPrime(15) > 0) rPrimes.add(p)
}
|