A030562 (# 1's)-(# 0's) in first n terms of A030548.
1, 1, 1, 1, 1, 2, 1, 2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 6, 7, 6, 7, 8, 7, 7, 8, 7, 7, 8, 7, 7, 8, 7, 7, 8, 9, 8, 9, 10, 11
Offset: 1
Keywords
Programs
-
Mathematica
Accumulate[Which[#==1,1,#==0,-1,True,0]&/@Flatten[IntegerDigits[Range[50],6]]] (* Harvey P. Dale, Jul 10 2023 *)