Fibonacci Time

In the Fibonacci sequence, F 0 = 1 F_{0}=1 , F 1 = 1 {F_1}=1 , and for all N > 1 N>1 , F N = F N 1 + F N 2 F_N=F_{N-1}+F_{N-2} .

How many of the first 2014 Fibonacci terms end in 0?


The answer is 134.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

5 solutions

Nafees Zakir
Sep 25, 2014
1
2
3
4
5
6
7
a, b = 1, 1
total = 0
for n in range(2014):
    if (a % 10) == 0:
        total += 1
    a, b = b, a+b  # the real formula for Fibonacci sequence
print total

Running this code gives you the Answer: 134

Aareyan Manzoor
Jan 13, 2015

note the formula G C D ( F n , F x ) = F G C D ( n . x ) ) GCD ( F_n,F_x)=F_{GCD(n.x))} for F n = { = 0 f o r n = 0 = 1 f o r n = 1 = F n 1 + F n 2 f o r n 2 F_n =\begin{cases} =0\quad for\quad n=0\\ =1\quad for\quad n=1\\ = F_{n-1}+F_{n-2}\quad for\quad n\geq 2 \end{cases} now, note that F 15 \quad F_{15}\quad is the first Fibonacci >0 dividable by 10. use the GCD formula, and lets see for a few G C D ( F 15 , F 30 ) = F G C D ( 15 , 30 ) = F 15 = 0 ( m o d 10 ) G C D ( F 30 , F 45 ) = F G C D ( 30 , 45 ) = F 15 = 0 ( m o d 10 ) G C D ( F 45 , F 60 ) = F G C D ( 45 , 60 ) = F 15 = 0 ( m o d 10 ) \begin{array}{c}GCD(F_{15},F_{30})=F_{GCD (15,30)}=F_{15} = 0\pmod {10}\\ GCD(F_{30},F_{45})=F_{GCD (30,45)}=F_{15} = 0\pmod {10}\\ GCD(F_{45},F_{60})=F_{GCD (45,60)}=F_{15} = 0\pmod {10}\\ \end{array} since GCD of these are 0 mod 10 these end with zero. but any n not divisible by 15 wont end with 0. there are 134 \quad \boxed{134}\quad multiples of 15 from 1 to 2015

Amazing ..learnt something new. It was great fun looking at list of Prime factorized forms of Fibonacci sequence members ...after knowing this GCD property!

Piyushkumar Palan - 2 years, 3 months ago

Log in to reply

here it is

Piyushkumar Palan - 2 years, 3 months ago

Note that a Fib number end with a 0 every 15 numbers, so just divide 2014 by 15 and take the greatest integer function of the quotient, which is 134.

Brooke Ji - 2 years, 1 month ago
Sam Thompson
Jan 20, 2014

After some computation, it is easy to see that F 14 F_{14} ends with 0. Now, we want to prove by induction that all Fibonacci numbers in the form F 15 n 1 F_{15n-1} end in 0. Since we already stated the base case, it suffices to show that our claim holds for all of these numbers. Let n n denote the unit's digit of F 15 n 2 F_{15n-2} . Thus, we can express the units digit (in m o d 10 \mod{10} ) as n , 0 , n , 2 n , 3 n , 5 n . . . . . n, 0, n, 2n, 3n, 5n..... . The coefficients of n n are equivalent to the first 15 Fibonacci numbers (treating zero as F 0 F_0 )! Thus, our claim is valid, and for every 15 consecutive terms, there is one term whose last digit is 0. Thus, our answer is 2014 15 = 134 \lfloor{\frac{2014}{15}}\rfloor=134

Whoops, note in the above solution, I made a mistake on lines 5 and 6. First, you do not have to treat F 0 F_0 as 0. Secondly, the terms should be n , 0 , n , n , 2 n , 3 n , 5 n . . . n, 0, n, n, 2n, 3n, 5n... instead of the terms listed in the solution.

Sam Thompson - 7 years, 4 months ago
Bilel Mabrouk
Jan 10, 2015

simple elegant code in C : #include <stdio.h>

int main(){
    int i,s=0,f0=1,f1=1;
    for (i=2;i<2014;i++){
        f1=(f0+f1)%10;
        f0=(f1-f0)%10;
        if (!f1)
            s++;
    }
    printf("%d",s);
    return 0;
}

P.S. : I used f1 (mod 10) and f2 (mod 10) because we only need the unit number

Lam Nguyen
Jan 6, 2015

We use another sequence with numbers from 0 to 9 that satisfy fn = xn (mod 10). It can be proven that this sequence repeats, and through trial shows that it repeats itself every 60 numbers, which include 4 0s the first 34 numbers include 2 0s So 134 is the answer

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...