The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A246016 a(n) = (-1)^A055941(n). 2

%I #28 Jul 26 2023 21:02:14

%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,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

%N a(n) = (-1)^A055941(n).

%C This sequence and A246017 are the subject of the Lafrance et al. (2014) paper.

%H Philip Lafrance, Narad Rampersad, Randy Yee, <a href="http://arxiv.org/abs/1408.2277">Some properties of a Rudin-Shapiro-like sequence</a>, arXiv:1408.2277 [math.CO], 2014.

%t b[n_] := b[n] = If[n == 0, 0, If[EvenQ[n], b[n/2] + DigitCount[n/2, 2, 1], b[(n-1)/2] + 1]];

%t a55941[n_] := b[n] - DigitCount[n, 2, 1];

%t a[n_] := (-1)^a55941[n];

%t Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Sep 23 2018 *)

%o (PARI) a055941(n) = {my(b=binary(n)); nb = 0; for (i=1, #b-1, if (b[i], nb += sum(j=i+1, #b, !b[j]));); nb;}

%o a(n) = (-1)^a055941(n);

%o (Python)

%o def A246016(n):

%o a, b = 0, 0

%o for i, j in enumerate(bin(n)[:1:-1]):

%o if int(j):

%o a ^= (i&1)^b

%o b ^= 1

%o return -1 if a else 1 # _Chai Wah Wu_, Jul 26 2023

%Y Cf. A055941, A161511, A246017 (partial sums).

%K sign

%O 0

%A _Michel Marcus_ and _N. J. A. Sloane_, Aug 13 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 23 05:59 EDT 2024. Contains 372758 sequences. (Running on oeis4.)