login
A037867
a(n)=(number of digits <=3)-(number of digits >3) in base 8 representation of n.
1
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, 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, -2, -2, -2, 3, 3, 3, 3, 1, 1, 1, 1, 3, 3, 3, 3, 1, 1, 1, 1, 3
OFFSET
1,8
MAPLE
A037867 := proc(n)
a := 0 ;
dgs := convert(n, base, 8);
for i from 1 to nops(dgs) do
if op(i, dgs)<=3 then
a := a+1 ;
else
a := a-1 ;
end if;
end do:
a ;
end proc:
seq(A037867(n), n=1..40) ; # R. J. Mathar, Jan 27 2025
MATHEMATICA
d8[n_]:=Module[{idn8=IntegerDigits[n, 8], lt4}, lt4=Count[idn8, _?(#<4&)]; 2lt4-Length[idn8]]; Array[d8, 80] (* Harvey P. Dale, Oct 22 2011 *)
CROSSREFS
Sequence in context: A230630 A343957 A338505 * A122879 A037866 A333181
KEYWORD
sign,base
STATUS
approved