login
A374179
a(n) is the least prime p such that the binary expansions of p and of the next prime q > p differ at exactly n positions, and p and q have the same binary length.
1
2, 11, 47, 139, 157, 191, 1151, 1531, 3067, 7159, 20479, 36857, 49139, 98299, 360439, 917503, 1310719, 786431, 6291449, 5242877, 20971507, 58720253, 83886053, 201326557, 335544301, 402653171, 3489660919, 1879048183, 5368709117, 25769803751, 21474836479, 77309411323
OFFSET
1,1
EXAMPLE
a(n): 2 11 47 139 157
np 3 13 53 149 163
[1 0] [1 0 1 1] [1 0 1 1 1 1] [1 0 0 0 1 0 1 1] [1 0 0 1 1 1 0 1]
[1 1] [1 1 0 1] [1 1 0 1 0 1] [1 0 0 1 0 1 0 1] [1 0 1 0 0 0 1 1]
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
n: 1 2 3 4 5
PROG
(Python)
from sympy import nextprime
def A374179(n):
p, pb = 2, 2
while (q:=nextprime(p)):
if pb==(qb:=q.bit_length()) and (p^q).bit_count() == n:
return p
p, pb = q, qb # Chai Wah Wu, Jul 10 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Hugo Pfoertner, Jul 09 2024
STATUS
approved