# 6.13: Exercise


Before you go on, you might want to work on the following exercise.

##### Exercise 6.1

There is an interesting connection between Fibonacci numbers and Pythagorean triples. If $$F$$ is a Fibonacci sequence, then

$\big(F_i F_{i+3}, \, 2 F_{i+1} F_{i+2}, \, F_{i+1}^2 + F_{i+2}^2 \big) \notag$

is a Pythagorean triple, for all $$i \ge 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 .

This page titled 6.13: Exercise is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Carey Smith via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.