login
A031232
a(n)=(# 1's)-(# 2's) in first n terms of A031219.
0
1, 0, 0, 0, 1, 1, 2, 3, 4, 3, 4, 4, 5, 5, 4, 4, 3, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 4, 3, 4, 4, 4, 5, 5, 5, 6, 7, 7, 8, 9, 10, 11, 12, 11, 12, 13, 13, 14, 15, 15, 16, 15, 15, 16, 15, 16, 17, 16
OFFSET
1,7
MATHEMATICA
Accumulate[Which[#==1, 1, #==2, -1, True, 0]&/@Flatten@IntegerDigits[ Range@ 40, 5]] (* Harvey P. Dale, Apr 26 2019 *)
CROSSREFS
Sequence in context: A097477 A059572 A031249 * A362024 A030583 A030563
KEYWORD
nonn
STATUS
approved