# Interesting facts about Fibonacci numbers

We know Fibonacci number, Fn = Fn-1 + Fn-2.

First few Fibonacci numbers are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, …. .

Here are some interesting facts about Fibonacci number :

1. Pattern in Last digits of Fibonacci numbers :
Last digits of first few Fibonacci Numbers are :

`0, 1, 1, 2, 3, 5, 8, 3, 1, 4, 5, 9, 4, 3, 7, 0, 7, ... `

The series of last digits repeats with a cycle length of 60 (Refer this for explanations of this result).

```// C program to demonstrate that sequence of last
// digits of Fibonacci numbers repeats after 60.
#include<stdio.h>
#define max 100
int main()
{
long long int arr[max];
arr[0] = 0;
arr[1] = 1;

// storing Fibonacci numbers
for (int i = 2; i < max; i++)
arr[i] = arr[i-1] + arr[i-2];

// Traversing through store numbers
for (int i = 1; i < max - 1; i++)
{
// Since first two number are 0 and 1
// so, if any two consecutive number encounter 0 and 1
// at their unit place, then it clearly means that
// number is repeating/ since we just have to find
// the sum of previous two number
if ((arr[i] % 10 == 0) && (arr[i+1] % 10 == 1))
break;
}
printf("Sequence is repeating after index %d", i);
}
```

Output:

```Sequence is repeating after index 60
```

2. Factors of Fibonacci number : On careful observation, we can observe the following thing :

• Every 3-rd Fibonacci number is a multiple of 2
• Every 4-th Fibonacci number is a multiple of 3
• Every 5-th Fibonacci number is a multiple of 5
• Every 6-th Fibonacci number is a multiple of 8

Refer this for details.

```// C program to demonstrate divisibility of Fibonacci
// numbers.
#include<stdio.h>
#define MAX 100

int main()
{
// indexes variable stores index of number that
// is divisible by 2, 3, 5 and 8
long long int arr[MAX], index1[MAX], index2[MAX];
long long int index3[MAX], index4[MAX];

// storing fibonacci numbers
arr[0] = 0;
arr[1] = 1;
for (int i = 2; i < MAX; i++)
arr[i] = arr[i-1] + arr[i-2];

// c1 keeps track of number of index of number
// divisible by 2 and others c2, c3 and c4 for
// 3, 5 and 8
int c1 = 0, c2 = 0, c3 = 0, c4 = 0;

// separating fibonacci number into their
// respective array
for (int i = 0; i < MAX; i++)
{
if (arr[i] % 2 == 0)
index1[c1++] = i;
if (arr[i] % 3 == 0)
index2[c2++] = i;
if (arr[i] % 5 == 0)
index3[c3++] = i;
if (arr[i] % 8 == 0)
index4[c4++] = i;
}

// printing index arrays
printf("Index of Fibonacci numbers divisible by"
" 2 are :\n");
for (int i = 0; i < c1; i++)
printf("%d  ", index1[i]);
printf("\n");

printf("Index of Fibonacci number divisible by"
" 3 are :\n");
for (int i = 0; i < c2; i++)
printf("%d  ", index2[i]);
printf("\n");

printf("Index of Fibonacci number divisible by"
" 5 are :\n");
for (int i = 0; i < c3; i++)
printf("%d  ", index3[i]);
printf("\n");

printf("Index of Fibonacci number divisible by"
" 8 are :\n");
for (int i = 0; i < c4; i++)
printf("%d  ", index4[i]);
printf("\n");
}
```

Output:

```Index of Fibonacci number divisible by 2 are :
0  3  6  9  12  15  18  21  24  27  30  33  36
39  42  45  48  51  54  57  60  63  66  69  72
75  78  81  84  87  90  93  96  99
Index of Fibonacci number divisible by 3 are :
0  4  8  12  16  20  24  28  32  36  40  44  48
52  56  60  64  68  72  76  80  84  88  92  96
98
Index of Fibonacci number divisible by 5 are :
0  5  10  15  20  25  30  35  40  45  50  55
60  65  70  75  80  85  90
Index of Fibonacci number divisible by 8 are :
0  6  12  18  24  30  36  42  48  54  60  66
72  78  84  90  96
```

3. Fibonacci number with index number factor : We have some Fibonacci number like F(1) = 1 which is divisible by 1, F(5) = 5 which is divisible by 5, F(12) = 144 which is divisible by 12, F(24) = 46368 which is divisible by 24, F(25) = 75025 which is divisible by 25. This type of index number follow a certain pattern. First, let’s keep a look on those index number :
1, 5, 12, 24, 25, 36, 48, 60, 72, 84, 96, 108, 120, 125, 132, …..
On observing it, this series is made up of every number that is multiple of 12 as well as all the number that satisfies the condition of pow(5, k), where k = 0, 1, 2, 3, 4, 5, 6, 7, …….

```// C program to demonstrate that Fibonacci numbers
// that are divisible by their indexes have indexes
// as either power of 5 or multiple of 12.
#include<stdio.h>
#define MAX 100

int main()
{
// storing Fibonacci numbers
long long int arr[MAX];
arr[0] = 0;
arr[1] = 1;
for (int i = 2; i < MAX; i++)
arr[i] = arr[i-1] + arr[i-2];

printf("Fibonacci numbers divisible by "
"their indexes are :\n");
for (int i = 1; i < MAX; i++)
if (arr[i] % i == 0)
printf("%d  ", i);
}
```

Output:

```Fibonacci numbers divisible by their indexes are :
1  5  12  24  25  36  48  60  72  96
```

4. Value of f(n-1)*f(n+1) – f(n)*f(n) is (-1)n. Please refer Cassini’s Identity for details.

# GATE CS Corner    Company Wise Coding Practice

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.
3.4 Average Difficulty : 3.4/5.0
Based on 5 vote(s)