6.11: Exercise
( \newcommand{\kernel}{\mathrm{null}\,}\)
Before you go on, you might want to work on the following exercise.
There is an interesting connection between Fibonacci numbers and Pythagorean triples. If F is a Fibonacci sequence, then
(FiFi+3,2Fi+1Fi+2,F2i+1+F2i+2)
is a Pythagorean triple, for all i≥1.
Write a function named fib_triple
that takes n
as an input variable, computes the first n
Fibonacci numbers, stores them in a vector, and checks whether this formula produces Pythagorean triples for numbers in the .