%I #21 Jun 24 2019 14:25:12
%S 2,2946,4,18,830,86,342,498,36002,2310,14660,3791908,138060,160110,
%T 998836,4345842,357341648,56717562,36609556,5972021576,2654687244,
%U 8237027666,22719286202,1542163060562,222365303318
%N a(n) is the least positive even number k such that among the first k prime numbers there are exactly k/2 prime numbers where the n-th least significant bit is one, or a(n) = -1 if no such k exists.
%C Is a(n) always positive?
%C If a(n) > 0, then a(n) >= 2*A000720(2^(n-1)-1). - _Chai Wah Wu_, Jun 13 2019
%F When a(n) > 0, Sum_{k = 1..a(n)} (-1)^floor(prime(k)/2^(n-1)) = 0 (where prime(k) denotes the k-th prime number).
%o (PARI) { s = vector(18); a = vector(#s); u = 1; forprime (p=2, oo, n++; for (b=1, #s, if (!a[b], s[b]+=(-1)^bittest(p,b-1); if (s[b]==0, a[b]=n; while (a[u], print1 (a[u]", "); u++; if (u>#a, break(3))))))) }
%o (Python)
%o from sympy import primepi
%o def A308575(n):
%o n2, t1 = 2**(n-1), 0
%o k = n2 - 1
%o kp = primepi(k)
%o kp2 = primepi(k+n2)-kp
%o while kp2 < kp or t1 >= kp:
%o k += n2
%o t1, t2 = kp, kp2
%o kp2 = primepi(k+n2) - kp2
%o kp = t2
%o return 2*kp # _Chai Wah Wu_, Jun 13 2019
%Y Cf. A000040, A000720.
%K nonn,base,more,hard
%O 1,1
%A _Rémy Sigrist_, Jun 08 2019
%E a(20)-a(23) from _Chai Wah Wu_, Jun 13 2019
%E a(24)-a(25) from _Chai Wah Wu_, Jun 24 2019