Fibonacci sequence: Difference between revisions
→{{header|PARI/GP}}: sinh
m (FutureBasic entry moved out of the Basic group) |
CRGreathouse (talk | contribs) (→{{header|PARI/GP}}: sinh) |
||
Line 10,418:
===Binary powering===
This is an efficient method (similar to the one used internally by <code>fibonacci()</code>), although running it without compilation won't give competitive speed.
<syntaxhighlight lang="parigp">fib(n)={
if(n<=0,
Line 10,491 ⟶ 10,492:
a
};</syntaxhighlight>
===Trigonometric===
This solution uses the complex hyperbolic sine.
<syntaxhighlight lang="parigp">fib(n)=real(2/sqrt(5)/I^n*sinh(n*log(I*(1+sqrt(5))/2)))\/1;</syntaxhighlight>
===Chebyshev===
|