Fibonacci Identities

Module to compute (Subscript[F, n]), the nth Fibonacci number:

computeFib[n_]:=Module[{acc0=0,acc1=1,next},
Do[
next=acc0+acc1;  (* compute the next value *)
acc0=acc1;               (* shift down *)
acc1=next,
{k,1,n}
];
acc0         (* return value *)
]

Try it out:

computeFib /@ Range[20]

Note that this version of computeFib also computes (Subscript[F, 0]) correctly:

computeFib[0]

Investigation

Compute (Subscript[F, n]^2)-(Subscript[F, n+1])(Subscript[F, n-1]) for various values of n. What do you observe? What do you wonder?

Let’s compute M values all at once:

M=1000;
fibs=computeFib/@Range[M];

Now make some lists:

fibSquared =( fibs*fibs)[[2;;M-1]];

Slice off the first two Fibonacci numbers:

fibA=fibs[[3;;M]];

fibB=fibs[[1;;M-2]];

Compute the identities

fibSquared-fibA*fibB;

This looks good, but let' s verify in an automated way.

Make a list of plus/minus 1:

plusminus=Table[(-1)^n,{n,1,M-2}];

results=fibSquared-fibA*fibB-plusminus;

Check that the results contain all zeros:

results==Table[0,{n,1,M-2}]

Now investigate another identity

Fix r:

r=2;

Compute new lists:

to be continued...