0% found this document useful (0 votes)
9 views11 pages

OOP2

The document discusses the Fibonacci sequence, a mathematical series where each term is the sum of the two preceding ones, starting with 0 and 1. It outlines the history of Fibonacci, the problem definition, methodology for generating the sequence using Java with for loops, and includes sample output. The conclusion emphasizes the importance of efficient algorithms in programming for problem-solving.

Uploaded by

hkk7kfv9np
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views11 pages

OOP2

The document discusses the Fibonacci sequence, a mathematical series where each term is the sum of the two preceding ones, starting with 0 and 1. It outlines the history of Fibonacci, the problem definition, methodology for generating the sequence using Java with for loops, and includes sample output. The conclusion emphasizes the importance of efficient algorithms in programming for problem-solving.

Uploaded by

hkk7kfv9np
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

FIBONACCI SEQUENCE

GENERATOR

Object
Oriented
Programming
Contents
• Introduction
• What is Fibonacci?
• History of Fibonacci
• Problem Definition
• Methodology
• Code and Sample Output
• Conclusion
• References
Introduction i

• The Fibonacci series is well-known mathematical sequence starting with 0


and 1, where each subsequent term is the sum of the two previous ones.
• It is often observed in nature as well as in computer science.
• It can be implemented with iterative and recursive methods and many
programming languages.

• We choose to use Java programming language and for loops as methods.


• For loops were chosen to optimize the algorithm and enhance performance
and efficiency.
• Our goal is to print the first N terms of the fibonacci series, while taking the
N as an input from the user.
What is Fibonacci?
• The Fibonacci sequence can start with either a one or a zero. Each number
in the sequence is the sum of two preceding numbers.

• When the first two terms are defined as 0 and 1, the sequence goes as
⚬ F(0) = 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55...

• When the first two terms are defined as 1 and 1, the sequence goes as
⚬ F(1) = 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89...

• Additionally, the ratio of any two consecutive


numbers in the Fibonacci sequence approaches
the golden ratio as the numbers increase. The
larger the numbers, the closer their ratio gets
to the golden ratio.
History of Fibonacci
• The Fibonacci sequence is named after the Italian mathematician
Leonardo Pisano, Also known as Fibonacci, who lived between 1170 and
1250. It was introduced in his work Liber Abaci, using a rabbit
reproduction problem as an Example. The problem is described as
follows:

⚬ “Every month, each pair of rabbits becomes productive starting


from the second Month, and every month, each pair gives birth to
one new pair. Starting with only one pair of rabbits, how many
pairs of rabbits will there be at the end of one year?”
Problem Definition
• The first two terms are: 1, 1.
• Starting from the third term, each number is the sum of the two preceding numbers .
• The resulting Fibonacci sequence is as follows :
⚬ 1, 1, 2, 3, 5, 8, 13, 21, 34...
• According to the problem we talked about, at the end of one year (the 12th term), the
total number of Rabbit pairs will be 144.

• Here, Fₙ represents the nth term of the Fibonacci


sequence, and phi (φ or ϕ ) represents the golden ratio.
• Few examples of Fibonacci patterns are Leonardo da
Vinci’s works, pine cone arrangements, sunflower seeds,
and seashells.
Methodology
1.Getting input from the user

2.Constructing the function

3.Creating the fibonacci sequence

4.Printing the results


Code and Sample Output

SAMPLE OUTPUT

Enter the number of Fibonacci terms


to generate(N): 15

Fibonacci Sequence: 0, 1, 1, 2, 3, 5, 8,
13, 21, 34, 55, 89, 144, 233, 377
Conclusion
• We focused on calculating and displaying the first N terms of the Fibonacci
sequence.
• We tried to optimize the algorithm for efficiency and readability by using for -
loops instead of recursive methods.
• This presentation tries to summarize the topic around the Fibonacci
sequence with its short history, definition of the general problem, the
method we used, and the code itself.
• The project highlights how algorithms and programming can be effectively
utilized in problem -solving.
References
https://bilimgenc.tubitak.gov.tr/makale/fibonacci -dizisinden-altin-orana
https:/ / www.bilimup.com/ dogadaki-altin-oran-fibonacci-dizisi
https:/ / dergi.salom.com.tr/ haber-308-fibonacci_ve_altin_oran.html
https:/ / tr.m.wikipedia.org/ wiki/ Fibonacci_dizisi
Java A Beginner's Guide 🔍🔍
McGraw-Hill Education; McGraw-Hill Osborne Media, Sixth edition, 2014 Schildt, Herbert page 48
Java How To Program (Early Objects) (10th Edition) Pearson, 10, 2014
Deitel, Paul J., Deitel, Harvey page 202
https:/ / byjus.com/ maths/ fibonacci-sequence/
https:/ / en.wikipedia.org/ wiki/ Fibonacci_sequence/
Thank you for listening.
Department of Computer Engineering

Object
Under the guidance of Oriented
Dr. John Olorunfemi Olaifa Programming

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy