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.
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
Examples
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
Programs
-
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