Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
131 views
in Technique[技术] by (71.8m points)

In the Fibonacci sequence, is fib(0) 0 or 1 ?

I'm doing a task in a subject were fib(0) is defined to = 1. But that can't be right? fib(0) is 0?

Program with fib(0) = 1; spits out fib(4) = 5
Program with fib(0) = 0; spits out fib(3) = 3

What is the correct definition?

question from:https://stackoverflow.com/questions/1451170/in-the-fibonacci-sequence-is-fib0-0-or-1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The definition with Fib(0) = 1 is known as the combinatorial definition, and Fib(0) = 0 is the classical definition. Both are used in the Fibonacci Quarterly, though authors that use the combinatorial definition need to add a sentence of explanation. Benjamin and Quinn in Proofs that Really Count use f_n for the nth combinatorial Fibonacci number and F_n for the nth classical Fibonacci number. The combinatorial definition is good, not surprisingly for counting questions like "How many ways are there to walk up a flight of n steps, taking either one or two steps at a time?" When n is 0, there's one way to do it, not zero ways.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...