Fibonacci matrix-exponentiation: Difference between revisions
Content deleted Content added
m →{{header|Wren}}: Minor tidy |
|||
Line 2,011: | Line 2,011: | ||
{{libheader|Wren-fmt}} |
{{libheader|Wren-fmt}} |
||
A tough task for Wren which takes just under 3 minutes to process even the 1 millionth Fibonacci number. Judging by the times for the compiled, statically typed languages using GMP, the 10 millionth would likely take north of 4 hours so I haven't attempted it. |
A tough task for Wren which takes just under 3 minutes to process even the 1 millionth Fibonacci number. Judging by the times for the compiled, statically typed languages using GMP, the 10 millionth would likely take north of 4 hours so I haven't attempted it. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">import "./big" for BigInt |
||
import "/fmt" for Fmt |
import "./fmt" for Fmt |
||
var mul = Fn.new { |m1, m2| |
var mul = Fn.new { |m1, m2| |
||
Line 2,129: | Line 2,129: | ||
Apart from the 2^16th number, the extra credit is still out of reach using this approach. |
Apart from the 2^16th number, the extra credit is still out of reach using this approach. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">import "./big" for BigInt |
||
import "/fmt" for Fmt |
import "./fmt" for Fmt |
||
var lucas = Fn.new { |n| |
var lucas = Fn.new { |n| |
||
Line 2,211: | Line 2,211: | ||
{{libheader|Wren-gmp}} |
{{libheader|Wren-gmp}} |
||
Ridiculously fast (under 5ms) thanks to the stuff borrowed from Sidef and Julia combined with the speed of GMP. |
Ridiculously fast (under 5ms) thanks to the stuff borrowed from Sidef and Julia combined with the speed of GMP. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">import "./gmp" for Mpz, Mpf |
||
import "./fmt" for Fmt |
import "./fmt" for Fmt |
||