Package dev.nm.analysis.sequence
Class Fibonacci
- java.lang.Object
-
- dev.nm.analysis.sequence.Fibonacci
-
- All Implemented Interfaces:
Sequence
public class Fibonacci extends Object implements Sequence
A Fibonacci sequence starts with 0 and 1 as the first two numbers. Each subsequent number is the sum of the previous two. For example,0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
- See Also:
- Wikipedia: Fibonacci number
-
-
Constructor Summary
Constructors Constructor Description Fibonacci(int length)
Construct a Fibonacci sequence.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
get(int i)
Get the i-th entry in the sequence, counting from 1.double[]
getAll()
Get a copy of the whole (finite) sequence indouble[]
.int
length()
Get the number of computed terms in the sequence.
-