## Basic Math in Programming

### Fibonacci Sequence

The Fibonacci sequence in math is defined as

$F_n = F_{n-1} + F_{n-2}$

In Python, we can easily generate a series of Fibonacci numbers up to a certain number $$N$$. One way to do this is with dynamic programming:

As the numbers get larger, the values of the Fibonacci sequence increases exponentially. What if we want to only get the last digit of the value?

By modding every value by 10, we make sure that we only keep the last digit of the values. This not only saves space, but also speeds up the program.

### LCM and GCD

GCD can be found using Euclid’s GCD algorithm.

LCM can be found with the property that $$GCD * LCM = x * y$$.