cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A037862 #11 Jan 27 2025 07:22:42
%S A037862 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 A037862 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 A037862 2,0,2,2,0,0,0,-2,0,0,-2,0,0,-2,-2,-2,-4,5,5,3
%N A037862 a(n)=(number of digits <=1)-(number of digits >1) in base 3 representation of n.
%F A037862 a(n) = A081604(n)-2*A081603(n). - _R. J. Mathar_, Jan 27 2025
%p A037862 A037862 := proc(n)
%p A037862     a := 0 ;
%p A037862     dgs := convert(n,base,3);
%p A037862     for i from 1 to nops(dgs) do
%p A037862         if op(i,dgs)<=1 then
%p A037862             a := a+1 ;
%p A037862         else
%p A037862             a := a-1 ;
%p A037862         end if;
%p A037862     end do:
%p A037862     a ;
%p A037862 end proc: # _R. J. Mathar_, Oct 16 2015
%t A037862 b3d[n_]:=Module[{idn=IntegerDigits[n,3]},Count[idn,_?(#<2&)]-Count[idn, _?(#>1&)]]; Array[b3d,90] (* _Harvey P. Dale_, Nov 08 2011 *)
%Y A037862 Cf. A081604, A081603.
%K A037862 base,sign
%O A037862 1,3
%A A037862 _Clark Kimberling_