OFFSET
0,3
COMMENTS
This sequence has similarities with A001196: here we square the length of each run of consecutive equal bits, there we double it.
LINKS
FORMULA
MATHEMATICA
squareList[v_] := Flatten[ConstantArray[v, {Length[v]}]]; a[n_] := FromDigits[ Flatten[squareList /@ Split[IntegerDigits[n, 2]]], 2]; Array[a, 60, 0] (* Amiram Eldar, Dec 07 2018*)
PROG
(PARI) a(n) = if (n==0, 0, my (b=n%2, k=valuation(n+b, 2)); (a(n\2^k) + b) * 2^(k^2) - b)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Nov 28 2018
STATUS
approved