aya1909's blog

By aya1909, history, 4 days ago, In English

Given a range [l r] find the sum of last digits of fibonacci numbers between l and r. i.e , last(fib(l))+last(fib(l+1)) .... last(fib(r)),

where last(fib(a)) denotes last digit of ath fibonacci number.

1<=l<=r<=1e9

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
4 days ago, # |
  Vote: I like it 0 Vote: I do not like it

one property of fibonacci number is last digit repeats at an interval of 60 .i think this will help.

»
4 days ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Using Pisano Period for $$$base = 10$$$ then we have $$$\pi(n) = 60$$$ numbers per cycle