OFFSET
1,3
MAPLE
A037862 := proc(n)
a := 0 ;
dgs := convert(n, base, 3);
for i from 1 to nops(dgs) do
if op(i, dgs)<=1 then
a := a+1 ;
else
a := a-1 ;
end if;
end do:
a ;
end proc: # R. J. Mathar, Oct 16 2015
MATHEMATICA
b3d[n_]:=Module[{idn=IntegerDigits[n, 3]}, Count[idn, _?(#<2&)]-Count[idn, _?(#>1&)]]; Array[b3d, 90] (* Harvey P. Dale, Nov 08 2011 *)
CROSSREFS
KEYWORD
base,sign
AUTHOR
STATUS
approved