Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Engineering LibreTexts

6.11: Exercise

( \newcommand{\kernel}{\mathrm{null}\,}\)

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

(FiFi+3,2Fi+1Fi+2,F2i+1+F2i+2)

is a Pythagorean triple, for all i1.

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.11: Exercise is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Allen B. Downey (Green Tea Press) via source content that was edited to the style and standards of the LibreTexts platform.

Support Center

How can we help?