[docs] [issue31757] Tutorial: Fibonacci numbers start with 1, 1
report at bugs.python.org
Wed Oct 11 12:07:56 EDT 2017
Mark Dickinson <dickinsm at gmail.com> added the comment:
Is there any particular reason you want to start with 1? While not universal, it's standard to define `Fib(0) = 0`, and to start the sequence at `0`. (And note that Python usually starts indexing things from 0, so it makes sense to start with `Fib(0)` rather than `Fib(1)`.)
In principle, one could define `Fib(0)=1`, `Fib(1)=1`, `Fib(1)=2`, and so on, but there's a strong reason not to do so: it breaks (or at least uglifies) many nice number-theoretic properties, like `gcd(Fib(m), Fib(n)) == Fib(gcd(m, n))`.
Python tracker <report at bugs.python.org>
More information about the docs