这篇文章主要介绍了php实现斐波那契数列的简单写法,需要的朋友可以参考下
斐波那契数列是非常常见的一类数列,,其数学定义为:F0=1,F1=1,Fn=F(n-1)+F(n-2)(n>=2,n∈N*)。本文就用php来简单实现斐波那契数列,代码十分简洁易懂,如下所示:
至此就实现了Fn=F(n-1)+F(n-2)中n在100以内的斐波那契数列的显示输出。
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn