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
# | User | Rating |
---|---|---|
1 | tourist | 3748 |
2 | Benq | 3540 |
3 | Petr | 3470 |
4 | Radewoosh | 3355 |
5 | ecnerwala | 3347 |
6 | maroonrk | 3345 |
7 | jiangly | 3324 |
8 | scott_wu | 3313 |
9 | ainta | 3298 |
10 | boboniu | 3289 |
# | User | Contrib. |
---|---|---|
1 | 1-gon | 200 |
2 | Errichto | 196 |
3 | rng_58 | 194 |
4 | SecondThread | 186 |
5 | awoo | 185 |
6 | Um_nik | 182 |
7 | vovuh | 179 |
8 | Ashishgup | 176 |
9 | maroonrk | 174 |
10 | -is-this-fft- | 173 |
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
Name |
---|
one property of fibonacci number is last digit repeats at an interval of 60 .i think this will help.
Using Pisano Period for $$$base = 10$$$ then we have $$$\pi(n) = 60$$$ numbers per cycle