login
(-1)^A081603(n), parity of the number of 2's in the ternary expansion of n.
1

%I #15 Sep 10 2012 03:05:45

%S 1,-1,1,1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,1,1,

%T -1,1,1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,

%U 1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,1,-1,1,1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,-1,1,1

%N (-1)^A081603(n), parity of the number of 2's in the ternary expansion of n.

%H A. Aksenov, <a href="http://arxiv.org/abs/1108.5352">The Newman phenomenon and Lucas sequence</a>, arXiv:1108.5352, chapter 6.

%e a(7) = -1 because 7 is 21 (has one 2s) in base 3, and (-1)^1 = -1.

%e a(8) = 1 because 8 is 22 (has two 2s) in base 3, and (-1)^2 = 1.

%p A081603 := proc(n)

%p local a,d ;

%p a := 0 ;

%p for d in convert(n,base,3) do

%p if d = 2 then

%p a := a+1 ;

%p end if;

%p end do;

%p a;

%p end proc:

%p A216430 := proc(n)

%p (-1)^A081603(n) ;

%p end proc:

%p seq(A216430(n),n=1..90) ;

%t Table[(-1)^DigitCount[n, 3, 2], {n, 90}] (* _Alonso del Arte_, Sep 08 2012 *)

%K sign,easy,base

%O 1

%A _R. J. Mathar_, Sep 08 2012