OFFSET
1,7
MATHEMATICA
Accumulate[Which[#==1, 1, #==2, -1, True, 0]&/@Flatten@IntegerDigits[ Range@ 40, 5]] (* Harvey P. Dale, Apr 26 2019 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved