[go: up one dir, main page]

login
A037869
a(n) = (number of digits <=4)-(number of digits >4) in base 10 representation of n.
1
1, 1, 1, 1, -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, -2, 0, 0, 0, 0, 0, -2, -2, -2, -2, -2, 0, 0, 0, 0, 0, -2, -2, -2, -2, -2, 0, 0
OFFSET
0,10
MAPLE
A037869 := proc(n)
a := 0 ;
dgs := convert(n, base, 10);
for i from 1 to nops(dgs) do
if op(i, dgs)<=4 then
a := a+1 ;
else
a := a-1 ;
end if;
end do:
a ;
end proc:
seq(A037869(n), n=1..100) ; # R. J. Mathar, Jul 31 2024
MATHEMATICA
f[n_]:=Module[{dcn=Partition[RotateRight[DigitCount[n]], 5]}, Total[First[dcn]]-Total[Last[dcn]]]; Array[f, 90] (* Harvey P. Dale, May 17 2011 *)
CROSSREFS
Sequence in context: A371929 A242050 A373096 * A037868 A173069 A363934
KEYWORD
base,sign
STATUS
approved