Calculate the sum of the first n Fibonacci numbers using arbitrary-precision arithmetic. Enter a positive integer and get the result using the standard Fibonacci sum identity.
Enter the number of Fibonacci terms you want to add. Large values are supported using PHP's BCMath arbitrary-precision arithmetic.
F(1) + F(2) + ... + F(n),
where
F(1)=1
and
F(2)=1.
The Fibonacci sequence is a sequence of numbers in which each term is obtained by adding the two preceding terms. With the convention used by this calculator, the sequence begins:
The recurrence relation is:
with the corresponding starting values
F(1)=1 and
F(2)=1.
Fibonacci numbers appear in mathematics, algorithms, combinatorics, recurrence relations and many mathematical investigations involving sequences and patterns.
One of the useful identities associated with the Fibonacci sequence is:
This identity means that the sum does not have to be calculated by adding every Fibonacci number individually. Instead, the calculator calculates the Fibonacci number at position n + 2 and subtracts 1.
For example, for the first five terms:
These examples show how the Fibonacci sum identity works.
1 + 1 + 2 + 3 + 5
= 12F(12) − 1
= 144F(22) − 1
= 17710Fibonacci numbers grow very quickly. Even though the recurrence relation is simple, the number of digits becomes large as n increases.
Standard PHP integer variables cannot represent arbitrarily large integers. This calculator therefore uses the BCMath extension to perform integer arithmetic using decimal strings.
This allows the calculator to work with Fibonacci numbers far beyond the range of ordinary fixed-size integer types.
A Fibonacci number can contain thousands or even tens of thousands of digits. Arbitrary-precision arithmetic prevents the rounding and overflow problems that can occur when very large integers are stored as ordinary numeric variables.
Fibonacci sums are useful in several areas of mathematics and computer science.
Fibonacci sums are one type of sequence summation. Summe.org also provides calculators for several other types of sums.
Explore other mathematical structures, integer properties and sequence-related calculators on Summe.org.
If you are using Fibonacci sequences as part of a broader mathematics study, Summe.org also includes tools for derivatives, limits, integration and algebra.
F(1)+F(2)+...+F(n)=F(n+2)-1.
1, 1, 2, 3, 5, 8, 13, 21, ....
Each term after the first two is the sum of the
previous two.
F(1)+F(2)+...+F(n)=F(n+2)-1.
This allows the sum to be obtained directly from one
Fibonacci number instead of repeatedly adding all
previous terms.
Continue exploring the mathematical calculators available on Summe.org.