项目作者: rcvenkata

项目描述 :
Recursive algorithm to calculate fibonacci numbers for an user input integer.
高级语言: Go
项目地址: git://github.com/rcvenkata/Fibonacci-number.git
创建时间: 2019-03-16T04:21:35Z
项目社区:https://github.com/rcvenkata/Fibonacci-number

开源协议:

下载


Fibonacci numbers/sequence

Introduction

Knowledge of the Fibonacci sequence was expressed as early as Pingala (c. 450 BC–200 BC).The Fibonacci numbers are important in the computational run-time analysis of Euclid’s algorithm to determine the greatest common divisor of two integers. The Fibonacci sequence is one of the most famous formulas in mathematics.Each number in the sequence is the sum of the two numbers that precede it. So, the sequence goes: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, and so on.

The mathematical equation describing it is

  1. Xn+2= Xn+1 + Xn

This elementary algorithm uses recursion to calculate fibonacci number for an user input number. This algorithm also serves as an example for time-complexities associated with recursion (compared to a iterative approach).

Usage

1. Download the .go file

2. Use shell/bash to navigate to the .go file directory

3. Build the .go file using the below command

  1. $ go build

4. Use the built executable as shown below to execute

  1. $ ./Fibonacci-number-master

5. When prompted enter the desired integer for which fibonacci number needs to be calculated (e.g., 30 as shown below)

  1. $ For what integer you need to calculate Fibonacci number?
  2. 30

References

https://en.wikipedia.org/wiki/Fibonacci_number

https://www.livescience.com/37470-fibonacci-sequence.html