A089600 Another lazy binary representation of n: similar to A089591 except that the single carry is performed before the increment instead of after.
0, 1, 2, 11, 12, 21, 102, 111, 112, 121, 202, 211, 1012, 1021, 1102, 1111, 1112, 1121, 1202, 1211, 2012, 2021, 2102, 2111, 10112, 10121, 10202, 10211, 11012, 11021, 11102, 11111, 11112, 11121, 11202, 11211, 12012, 12021, 12102, 12111, 20112
Offset: 0
Programs
-
Maple
A089591 := proc(n) option remember ; local nhalf ; if n <= 1 then RETURN(n) ; else nhalf := floor(n/2) ; if n mod 2 = 1 then RETURN(10*A089591(nhalf) +1) ; else RETURN(10*(A089591(nhalf-1)+1)) ; fi ; fi ; end: A089600 := proc(n) option remember ; local nhalf ; nhalf := floor(n/2) ; if n <= 1 then RETURN(n) ; else if n mod 2 = 1 then RETURN(10*A089600(nhalf) +1) ; else RETURN(10*A089591(nhalf-1)+2) ; fi ; fi ; end: for n from 0 to 200 do printf("%d, ",A089600(n)) ; od ; # R. J. Mathar, Mar 11 2007
Formula
Let b(n) = A089591(n). Then a(0) = b(0) = 0; b(n) = if n is odd then b((n-1)/2):1 else a(n/2):0; a(n) = if n is odd then a((n-1)/2):1 else b(n/2-1):2.
Extensions
More terms from R. J. Mathar, Mar 11 2007