login
a(n)=(number of digits <=3)-(number of digits >3) in base 8 representation of n.
1

%I #9 Jan 27 2025 07:58:30

%S 1,1,1,-1,-1,-1,-1,2,2,2,2,0,0,0,0,2,2,2,2,0,0,0,0,2,2,2,2,0,0,0,0,0,

%T 0,0,0,-2,-2,-2,-2,0,0,0,0,-2,-2,-2,-2,0,0,0,0,-2,-2,-2,-2,0,0,0,0,-2,

%U -2,-2,-2,3,3,3,3,1,1,1,1,3,3,3,3,1,1,1,1,3

%N a(n)=(number of digits <=3)-(number of digits >3) in base 8 representation of n.

%p A037867 := proc(n)

%p a := 0 ;

%p dgs := convert(n, base, 8);

%p for i from 1 to nops(dgs) do

%p if op(i, dgs)<=3 then

%p a := a+1 ;

%p else

%p a := a-1 ;

%p end if;

%p end do:

%p a ;

%p end proc:

%p seq(A037867(n),n=1..40) ; # _R. J. Mathar_, Jan 27 2025

%t d8[n_]:=Module[{idn8=IntegerDigits[n,8],lt4},lt4=Count[idn8,_?(#<4&)];2lt4-Length[idn8]]; Array[d8,80] (* _Harvey P. Dale_, Oct 22 2011 *)

%K sign,base

%O 1,8

%A _Clark Kimberling_