OFFSET
0,4
COMMENTS
a(n) deletes any trailing '10' bit pairs from n. So in base 4, it removes all trailing '2' digits.
LINKS
Amiram Eldar, Table of n, a(n) for n = 0..10000
FORMULA
Sum_{k=1..n} a(k) ~ 2 * n^2 / 5. - Amiram Eldar, Aug 30 2024
EXAMPLE
Numbers between '' are in base 2: '0'->'0', so a(0)=0. '110'->'1', so a(6)=1. '1010'->'10' -> '0', so a(10)=0. a(floor((2^1000001)/3))=0.
MATHEMATICA
a[n_] := a[n] = If[Mod[n, 4] == 2, a[(n - 2)/4], n]; Array[a, 100, 0] (* Amiram Eldar, Dec 14 2021 *)
PROG
(PARI) a(n) = if(2!=(n%4), n, my(m=3*n+2); m=m/4^valuation(m, 4); (m+1)/3-1)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Ruud H.G. van Tol, Dec 14 2021
STATUS
approved