login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A374178
a(n) is the least prime p such that p and the next prime > p have exactly n common 1's in their binary expansion.
2
2, 5, 19, 29, 181, 359, 379, 983, 3821, 3581, 8179, 16111, 81901, 98297, 131059, 131063, 524269, 917471, 3145679, 4128763, 16744423, 16776187, 58720223, 117440381, 266330047, 468713467, 536870879, 1073741309, 2147483629, 4294967231, 8589410287, 33285865469
OFFSET
1,1
COMMENTS
1
LINKS
EXAMPLE
a(n): 2 5 19 29 181
np 3 7 23 31 191
[1 0] [1 0 1] [1 0 0 1 1] [1 1 1 0 1] [1 0 1 1 0 1 0 1]
[1 1] [1 1 1] [1 0 1 1 1] [1 1 1 1 1] [1 0 1 1 1 1 1 1]
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
n: 1 2 3 4 5
PROG
(Python)
from sympy import nextprime
def A374178(n):
p = 2
while (q:=nextprime(p)):
if (p&q).bit_count() == n:
return p
p = q # Chai Wah Wu, Jul 08 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Hugo Pfoertner, Jul 08 2024
STATUS
approved