Javatpoint Logo
Javatpoint Logo

Nth even Fibonacci Sequence

The Fibonacci sequence is a cool math thing where you start with 0 and 1, and each next number is the sum of the previous two. It was invented by this old Italian dude Fibonacci back in the Middle Ages. He realized that rabbit populations grow this way (each new generation comes from the sum of the previous two). Anyway, the sequence goes 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 and keeps going forever. The even numbers in the sequence, like 2, 8, 34, are extra interesting. They have some neat mathematical properties that math geeks like to study. We shall examine the formula in this article that allows us to compute any desired Nth, even the Fibonacci number, without having to compute the full series. With the help of this method, we may quickly examine features of higher order, even Fibonacci numbers, which would be difficult to get by calculating the entire series recursively. By understanding this formula, we gain insight into these unique even numbers' mathematical patterns and relationships.

Understanding The Fibonacci Sequence

This numerical pattern called the Fibonacci sequence, starts with 0 and 1, and each number after that is found by adding up the previous two. So it goes 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, and keeps going. A medieval Italian math dude named Fibonacci wrote about this sequence in the 1200s. He realized it shows up all over in nature - in the spirals of seashells, the

arrangement of leaves, the branching of trees, even the family tree of male and female rabbits! Each new baby rabbit pair comes from the total of the previous two pairs. Wild how a simple mathematical formula makes this pattern visible in plants, animals, and galaxies. This Fibonacci sequence has intrigued mathematicians and scientists for centuries. They say certain Fibonacci numbers like 2, 8 and 34 have unique mathematical properties. But in the end, it's just a quirky pattern that mysteriously connects math, nature and beauty.

The Fibonacci sequence's principal characteristics are:

  • Every number is the product of the two numbers before it.
  • We start the series with 0 and 1.
  • It adheres to the recursive equation: Fn equals Fn-1 plus Fn-2.
  • A few examples are:
    • F3 = F2 + F1 = 1 + 1 = 2.
    • F4 = F2 + F3 = 2 + 1 = 3.
    • F4 + F3 = 3 + 2 = 5 is F5.

Even Fabonacci Series:

Within the Fibonacci sequence, we can look at just the even-valued terms. These are:

2, 8, 34, 144, 610, 2584, 10946, 46368, 196418, 832040, ...

We call this the "even Fibonacci sequence". It follows similar recursive properties:

  • Each even term is 4 times the previous even term plus the term before that.
  • It begins with 2 and 8.
  • It follows: Fn = 4*Fn-1 + Fn-2

Some examples:

  • F3 = 4*F2 + F1 = 4*8 + 2 = 34
  • F4 = 4*F3 + F2 = 4*34 + 8 = 144
  • F5 = 4*F4 + F3 = 4*144 + 34 = 610

So even the Fibonacci numbers follow a predictable pattern that allows direct calculation of any Nth even term without needing the whole sequence. This makes it easy to study their properties.

Properties of Even Fibonacci Series

  • Each even Fibonacci number is divisible by 2. It is clear from the definition that we only consider the even terms of the sequence.
  • Each even Fibonacci number is divisible by 3. This can be proven mathematically by induction.
  • The Nth even Fibonacci number F(n) is always divisible by F(n-2). This is because of the recursive formula F(n) = 4*F(n-1) + F(n-2).
  • Even Fibonacci numbers grow exponentially as N increases. Specifically, the Nth even Fibonacci number is approximately equal to φ^(2n)/5, where φ is the golden ratio. This exponential growth rate can be derived from the closed-form equation.
  • Only every 3rd, even Fibonacci number, is divisible by 5. This pattern arises because the repeating remainder sequence for even Fibonacci numbers modulo 5 is {0, 2, 2, 0, 2, 2, ...}.
  • The Nth even Fibonacci number ends in the digit 2 if N is divisible by 3 and ends in 8 if N is one more than a multiple of 3. This can be proven by modular arithmetic.
  • Even Fibonacci numbers have a closed-form equation, which can be derived from the Binet formula for Fibonacci numbers in general:

Where φ is the golden ratio, this allows calculation in O(1) time.

  • Even Fibonacci numbers grow very rapidly. F(48) has over 14 decimal digits, while F(100) has over 208 decimal digits! The exponential growth quickly yields extremely large numbers.

These are some of the most significant and interesting properties that differentiate the even Fibonacci numbers from the sequence as a whole. The recursive formula and exponential growth lead to many unique mathematical patterns.

Uses of Nth even Fibonacci Number

  • Studying divisibility - The recursive formula and modular properties of even Fibonacci numbers make them useful for exploring divisibility questions and primality testing.
  • Generating large primes - Even Fibonacci numbers grow rapidly, and numbers of the form F(n) ± 1 for large n often generate large prime numbers. These are useful for cryptography and other applications.
  • Pseudorandom number generation - The sequence of even Fibonacci numbers exhibits some randomness properties that can be utilized to generate pseudorandom numbers, hashes, or encryption keys.
  • Computer science algorithms - Fast doubling algorithms for exponentiation utilize properties of even Fibonacci numbers. The sequence also provides examples of computational algorithms.
  • Modelling plant growth - The exponential growth pattern of even Fibonacci numbers can model the expanding growth of plant leaves, petals, and branching patterns.
  • Art and architecture - Fibonacci numbers and the golden ratio appear frequently in artistic works, architecture, and design. Knowledge of their properties facilitates analysis and construction.
  • General mathematics - Even Fibonacci numbers form examples for studying mathematical properties like recursion, modular arithmetic, exponentiation, primes, and more. They are a rich source of mathematical patterns.

The predictable recursive pattern coupled with exponential growth makes even Fibonacci numbers a fascinating mathematical object with many applications in pure and applied mathematics, computer science, cryptography, biology, and artistic domains. Calculating any Nth directly, even the Fibonacci number, is key to enabling these applications.

Approach to Implement

We will utilize the recursive formula for even Fibonacci numbers:

F(n) = 4 * F(n-1) + F(n-2)

With base cases:

F(1) = 2

F(2) = 8

The implementation will follow these steps:

  1. Define a function getEvenFib(n) that takes in an integer n, representing the Nth term to calculate.
  2. Handle base cases by returning 2 if n==1 and 8 if n==2.
  3. Initialize two variables:
    • prev = 2
    • curr = 8
  4. Use a loop to iteratively calculate F(n)
    • On each iteration:
      • Calculate next = 4 * curr + prev
      • Update prev = curr
      • Update curr = next
  5. Return curr after loop terminates

This implements the formula directly, iteratively calculating each term and updating the previous two terms until we reach the desired Nth term.

The time complexity is O(n) as we must iterate up to the Nth term.

Space complexity is O(1) since only two integer variables are needed for the previous two terms.

Some optimizations like memoization could improve efficiency, but this provides the basic algorithm for any language.

This approach efficiently and directly calculates the Nth even Fibonacci number using the mathematical recursive formula without generating unnecessary sequence terms.

# Function to return Nth even Fibonacci number


Nth even Fibonacci Sequence


  1. Define the get_even_fib() function, which takes in input n
  2. Handle base cases by returning 2 if n==1 and 8 if n==2
  3. Initialize two variables, prev and curr, as 2 and 8, respectively, to represent the first two even Fibonacci terms
  4. Use a for loop to iterate from 3 to n:
    • Calculate next_term using the formula: 4 * curr + prev
    • Update prev = curr
    • Update curr = next_term
    • This iteratively calculates each Fibonacci term
  5. After the loop ends, curr contains the Nth even Fibonacci term
  6. Return curr

This directly implements the formula by iteratively calculating each term up to the Nth term in linear time and constant space.


The even-valued Fibonacci numbers form an intriguing mathematical sequence exhibiting many unique properties. In this article, we derived the formula to directly calculate any desired Nth, even Fibonacci number, avoiding the need to compute the entire sequence. We discussed how the recursive relationship and exponential growth rate of even Fibonacci numbers lead to applications in numerous fields, including computer science, cryptography, biology, and art. The simple linear time algorithm provides an efficient technique to explore these properties programmatically for higher order even Fibonacci numbers. While the classic Fibonacci sequence has mesmerized mathematicians for centuries, the even-valued members of the sequence deserve special attention. Their elegant formula, rapid growth, and mathematical patterns make even Fibonacci numbers a fascinating topic for theoretical analysis and practical use cases. The ability to efficiently calculate any Nth, even Fibonacci number, is key to unlocking their potential.

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA