Alexander B. answered • 05/18/18

Advanced Math and Science Tutoring and Test Prep online (SAT, ACT)

First, let's notice that the position p of rightmost "1" in the sequence should satisfy the equation:

p

^{2}+p < 2*nbased on the observation that the sum of the elements to the left of that rightmost "1" is

s = 0.5(p+1)*p

corresponding to the series:

1+2+3+4 +... +p

Position p must be a whole number calculated as the root of quadratic equation p

^{2}+p -2n =0 rounded down (notice the Int operator):p

_{round}= Int (-p/2 + √(p2/4 +2n))The answer will be found as a difference: n - 0.5p

_{round}(p_{round +1)}In this particular case of n=5060, p

_{round}= 100, thus a_{n}= 5060 - 0.5*100*101 = 10_{}an = 10 (the answer)