To increase the binary digit, you need to flip the first zero at the end of your number and all previous ones. The cost of this operation is proportional to the number 1 at the end of your input (for this, your should represent the number as a list from right to left, for example, a list of [1; 0; 1; 1] codes for 13).
Let a (n) be the number 1 at the end of n:
a(n) = 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, ...
let it go
s(k) = a(2^k) + a(2^k+1) + ... + a(2^(k+1)-1)
is the sum of the elements between two degrees 2. You must make sure that s (k + 1) = 2 * s (k) + 1 (with s (0) = 1), noting that
a(2^(k+1)) ..., a(2^(k+2) - 1)
obtained by concatenation
a(2^k) + 1, ..., a(2^(k+1) - 1) and a(2^k), ..., a(2^(k+1) - 1)
And therefore, as a geometric series, s (k) = 2 ^ k - 1.
Now the cost of incrementing N times the number should be proportional
a(0) + a(1) + ... + a(N) = s(0) + s(1) + s(2) + ... + s(log(N)) = 2^0 - 1 + 2^1 -1 + 2^2-1 + ... + 2^log(N) - 1 = 2^0 + 2^1 + 2^2 + ... + 2^log(N) - log(N) - 1 = 2^(log(N) + 1) - 1 - log(N) - 1 = 2N - log(N) - 2
Therefore, if you have taken care to represent your numbers from right to left, then the naive algorithm is linear (note that you can rename and remain linear if you really need your numbers on the contrary).