golang / tour

[mirror] A Tour of Go
BSD 3-Clause "New" or "Revised" License
1.55k stars 520 forks source link

tour: [REPLACE WITH SHORT DESCRIPTION] #921

Closed dankirkpatrick closed 4 years ago

dankirkpatrick commented 4 years ago

Context: http://127.0.0.1:3999/moretypes/26

Fibonacci sequence does not start at '0'. It starts at '1'. The instructions show that the fibonacci sequence appears as (0, 1, 1, 2, 3, 5, ...).

The solution at https://github.com/golang/tour/blob/master/solutions/fib.go starts at '1' correctly.

dankirkpatrick commented 4 years ago

Looks like I am using the combinatorial definition of the Fibonacci sequence (starts at '1'). So I'm a little off in my bug report above. But it still stands that the solution is for the combinatorial definition, not for the "actual" definition that starts at '0'.

ALTree commented 4 years ago

We are using http://oeis.org/A000045 so it starts at 0 (with F_0). Also the solution you linked prints 0 as the first element so I don't see any misalignment there.

Closing here, but feel free to comment if you disagree.