login
A031248
a(n)=(# 1's)-(# 2's) in first n terms of A031235.
0
1, 0, 0, 0, 0, 1, 2, 3, 2, 3, 3, 4, 4, 5, 5, 4, 5, 4, 3, 2, 2, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 3, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 7, 8, 9, 10, 9, 10, 11, 11, 12, 13, 13, 14, 15, 15, 14, 15, 16, 15, 16, 15, 14
OFFSET
1,7
MATHEMATICA
Accumulate[Which[#==1, 1, #==2, -1, True, 0]&/@(Reverse[IntegerDigits[ #, 5]]&/@ Range[ 0, 40]//Flatten)] (* Harvey P. Dale, Aug 02 2016 *)
CROSSREFS
Sequence in context: A112212 A102314 A205146 * A030582 A217438 A036762
KEYWORD
nonn
STATUS
approved