Problem #129
Fragger and his sequence
Fibonacci sequence is defined as follow: F_1 = 1, F_2 = 2 , F_i = F_{i-1} + F_{i-2} (i > 2) .
Every natural number X can be represented in Fibonacci system such that X is sum of one or more distinct Fibonacci numbers in such a way that the sum does not include any two consecutive Fibonacci numbers.
Let X = A_1 * F_1 + A_2 * F_2 + A_3 * F_3 + …..…+ A_{k-1} * F_{k-1} + A_k * F_k where 0 <= A_p <= 1 \forall p < k and A_k = 1
We will represent X in Fibonacci system as : A_kA_{k-1}A_{k-2}………..A_1 Example 1 = (1) _F , 2 = (10)_F , 3 = (100)_F , 4 = (101)_F
If we write representation of all natural numbers in Fibonacci system consecutively we will obtain a new sequence ( say fragger sequence ) which will look like this : 1,1,0,1,0,0,1,0,1 …….
You need to count the number of times 1 appears in the first 10^{15} terms of fragger sequence.