Assuming I’m asked to generate Fibonacci numbers up to N, how many numbers will I generate? I’m looking for the count of Fibonacci numbers up to N, not the Nth number.
So, as an example, if I generate Fibonacci numbers up to 25, I will generate:
- 1, 1, 2, 3, 5, 8, 13, 21
- that’s 8 numbers
How do I calculate this mathematically for an arbitrary “n”?
You can use the following formula (see here):