login
A308575
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.
1
2, 2946, 4, 18, 830, 86, 342, 498, 36002, 2310, 14660, 3791908, 138060, 160110, 998836, 4345842, 357341648, 56717562, 36609556, 5972021576, 2654687244, 8237027666, 22719286202, 1542163060562, 222365303318
OFFSET
1,1
COMMENTS
Is a(n) always positive?
If a(n) > 0, then a(n) >= 2*A000720(2^(n-1)-1). - Chai Wah Wu, Jun 13 2019
FORMULA
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).
PROG
(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))))))) }
(Python)
from sympy import primepi
def A308575(n):
n2, t1 = 2**(n-1), 0
k = n2 - 1
kp = primepi(k)
kp2 = primepi(k+n2)-kp
while kp2 < kp or t1 >= kp:
k += n2
t1, t2 = kp, kp2
kp2 = primepi(k+n2) - kp2
kp = t2
return 2*kp # Chai Wah Wu, Jun 13 2019
CROSSREFS
Sequence in context: A242109 A078457 A128148 * A158348 A158904 A358177
KEYWORD
nonn,base,more,hard
AUTHOR
Rémy Sigrist, Jun 08 2019
EXTENSIONS
a(20)-a(23) from Chai Wah Wu, Jun 13 2019
a(24)-a(25) from Chai Wah Wu, Jun 24 2019
STATUS
approved