%I #9 Oct 16 2015 16:28:00
%S 1,-1,2,2,0,0,0,-2,3,3,1,3,3,1,1,1,-1,1,1,-1,1,1,-1,-1,-1,-3,4,4,2,4,
%T 4,2,2,2,0,4,4,2,4,4,2,2,2,0,2,2,0,2,2,0,0,0,-2,2,2,0,2,2,0,0,0,-2,2,
%U 2,0,2,2,0,0,0,-2,0,0,-2,0,0,-2,-2,-2,-4,5,5,3
%N a(n)=(number of digits <=1)-(number of digits >1) in base 3 representation of n.
%p A037862 := proc(n)
%p a := 0 ;
%p dgs := convert(n,base,3);
%p for i from 1 to nops(dgs) do
%p if op(i,dgs)<=1 then
%p a := a+1 ;
%p else
%p a := a-1 ;
%p end if;
%p end do:
%p a ;
%p end proc: # _R. J. Mathar_, Oct 16 2015
%t b3d[n_]:=Module[{idn=IntegerDigits[n,3]},Count[idn,_?(#<2&)]-Count[idn, _?(#>1&)]]; Array[b3d,90] (* _Harvey P. Dale_, Nov 08 2011 *)
%K base,sign
%O 1,3
%A _Clark Kimberling_