Fermat numbers: Difference between revisions

m
m (syntax highlighting fixup automation)
m (→‎{{header|Wren}}: Minor tidy)
Line 2,700:
{{libheader|Wren-big}}
The first seven Fermat numbers are factorized in about 0.75 seconds but as it would take 'hours' to get any further I've stopped there.
<syntaxhighlight lang="ecmascriptwren">import "./big" for BigInt
 
var fermat = Fn.new { |n| BigInt.two.pow(2.pow(n)) + 1 }
Line 2,755:
 
The overall time for this particular run was about 86 seconds with F₇ being found in only a couple of them. However, being non-deterministic, ECM is quite erratic time-wise and could take up to 3 minutes longer.
<syntaxhighlight lang="ecmascriptwren">/* fermat_numbers_gmpfermat_numbers_2.wren */
 
import "./gmp" for Mpz
Line 2,808:
F₅ = [641, 6700417]
F₆ = [274177, 67280421310721]
F₇ = [59649589127497217, 5704689200685129054721]
F₈ = [1238926361552897, 93461639715357977769163558199606896584051237541638188580280321]
 
9,483

edits