HP Forums
(38G) Fibonacci Numbers - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (38G) Fibonacci Numbers (/thread-3564.html)



(38G) Fibonacci Numbers - Gerald H - 04-06-2015 11:19 AM

Two programmes:

FIBO takes non-negative integer input N & returns the Nth Fibonacci number in Ans, exact for N < 60.

FIBO

ROUND(((1+√5)/2)^Ans/√5,0)-(Ans>55)-(Ans>57)*2-(Ans>58)*2:

FIBO? takes non-negative integer input N & returns 1 if N is a Fibonacci number, else 0, correct for N < 447214.

FIBO?

5*Ans^2+4:
IFTE(FRAC(√Ans),IFTE(FRAC(√(Ans-8)),0,1),1):


RE: HP 38G: Fibonacci Numbers - Gerald H - 04-28-2015 05:52 AM

You can put the formula in the Sequence Aplet using the programme FIBOSEQ.

U2 gives the partial sums of the Fibonacci series.

FIBOSEQ

RUN SEQSET:
RECURSE(U,ROUND(((1+√5)/2)^N/√5,0)-(N>55)-(N>57)*2-(N>58)*2,1,1)►U1(N):
CHECK 1:
RECURSE(U,U1(N+2)-1,1,2)►U2(N):
CHECK 2: