login
A031266
a(n)=(# 1's)-(# 2's) in first n terms of A031253.
0
1, 1, 2, 2, 3, 2, 3, 3, 2, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 3, 4, 4, 4, 5, 6, 7, 8, 9, 9, 10, 9, 9, 10, 9, 8, 9, 8, 8, 9, 9, 10, 11, 11, 11, 12, 12, 12, 13, 13, 12, 13, 13, 13, 12, 12, 13, 12, 12, 12, 11, 12, 12, 11, 12, 11, 10, 11, 11
OFFSET
1,3
MATHEMATICA
Accumulate[Which[#==1, 1, #==2, -1, True, 0]&/@(Table[IntegerDigits[2n-1, 5], {n, 60}]//Flatten)] (* Harvey P. Dale, Apr 16 2024 *)
CROSSREFS
Sequence in context: A072832 A080328 A245555 * A238459 A109301 A107573
KEYWORD
nonn
STATUS
approved