login
Let c1(p) be the number of primes <= p with an odd number of 1's in base 2, and let c2(p) be the number of primes <= p with an even number of 1's in base 2. a(n) is the least prime p such that abs(c1(p) - c2(p)) >= n.
0

%I #17 Apr 07 2023 09:26:29

%S 2,13,41,61,67,79,109,131,137,173,179,181,191,193,211,223,227,229,233,

%T 239,241,251,587,613,617,641,653,659,661,719,727,733,761,769,829,953,

%U 967,971,1009,1021,1039,1069,1087,1193,1201,1213,1697,1721,1753,1759,1777,1783,1787

%N Let c1(p) be the number of primes <= p with an odd number of 1's in base 2, and let c2(p) be the number of primes <= p with an even number of 1's in base 2. a(n) is the least prime p such that abs(c1(p) - c2(p)) >= n.

%e a(1) = 2, because c1(2) = 1 and c2(2) = 0, so abs(c1(2) - c2(2)) = 1 >= 1, and no lesser prime satisfies this.

%o (PARI) { r = 0; n = 1; forprime (p = 2, 1787, r += (-1)^hammingweight(p); if (n==abs(r), print1 (p", "); n++;);); } \\ _Rémy Sigrist_, Mar 01 2023

%Y Cf. A130911, A027697, A027699.

%K nonn,base

%O 1,1

%A _Jean-Marc Rebert_, Mar 01 2023