OFFSET
1,5
MATHEMATICA
Accumulate[Which[#==1, 1, #==0, -1, True, 0]&/@Flatten[Table[Reverse[IntegerDigits[n, 3]], {n, 40}]]] (* Harvey P. Dale, Jul 25 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved