Skip to content

Recursive algorithm to calculate fibonacci numbers for an user input integer.

Notifications You must be signed in to change notification settings

rchirravurivenkata/Fibonacci-number

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

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

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

$ go build

4. Use the built executable as shown below to execute

$ ./Fibonacci-number-master

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

$ For what integer you need to calculate Fibonacci number? 

30

References

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

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

About

Recursive algorithm to calculate fibonacci numbers for an user input integer.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages