login
a(1)=0, a(2n) = a(n)+1, a(2n+1) = 10*a(n+1).
2

%I #19 Sep 08 2022 08:44:28

%S 0,1,10,2,100,11,20,3,1000,101,110,12,200,21,30,4,10000,1001,1010,102,

%T 1100,111,120,13,2000,201,210,22,300,31,40,5,100000,10001,10010,1002,

%U 10100,1011,1020,103,11000,1101,1110,112,1200,121,130,14,20000,2001,2010

%N a(1)=0, a(2n) = a(n)+1, a(2n+1) = 10*a(n+1).

%H T. D. Noe, <a href="/A001202/b001202.txt">Table of n, a(n) for n = 1..8192</a>

%t Clear[t]; t[1] = 0; t[n_] := t[n] = If[Mod[n, 2] == 0, t[n/2] + 1, 10*t[(n + 1)/2]]; Table[t[n], {n, 2^8}] (* _T. D. Noe_, Jun 26 2012 *)

%o (Magma) [n eq 1 select 0 else IsEven(n) select Self(n div 2)+1 else 10*Self((n+1) div 2): n in [1..60]]; // _Bruno Berselli_, Mar 07 2013

%K nonn,easy

%O 1,3

%A _N. J. A. Sloane_

%E Explanation (and correction) supplied by Jay Coskey (jmc(AT)tera.com) 8/97.