• Home
  • About
    • Shadow Knight photo

      Shadow Knight

      https://live.bilibili.com/9565678

    • Learn More
    • Twitter
    • Facebook
    • Instagram
    • Github
    • Steam
  • Posts
    • All Posts
    • All Tags
  • Projects

go-斐波那契数列

16 May 2018

Reading time ~1 minute

斐波那契数列

链接:斐波那契数列讲解

斐波那契数列中的斐波那契数会经常出现在我们的眼前——比如松果、凤梨、树叶的排列、某些花朵的花瓣数(典型的有向日葵花瓣),蜂巢,蜻蜓翅膀,超越数e(可以推出更多),黄金矩形、黄金分割、等角螺线,十二平均律等。

package main

import "fmt"

func main()  {
	x:=1
	s:=0
	a:=0
	for i:=0;i<12 ;i++  {


	a=s+x
     x=s
     s=a

		fmt.Println(a)

	}
	fmt.Println(a)
}



斐波那契数列 Share Tweet +1