Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #14 Jul 10 2024 15:03:17
%S 2,11,47,139,157,191,1151,1531,3067,7159,20479,36857,49139,98299,
%T 360439,917503,1310719,786431,6291449,5242877,20971507,58720253,
%U 83886053,201326557,335544301,402653171,3489660919,1879048183,5368709117,25769803751,21474836479,77309411323
%N 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.
%e a(n): 2 11 47 139 157
%e np 3 13 53 149 163
%e [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]
%e [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]
%e ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
%e n: 1 2 3 4 5
%o (Python)
%o from sympy import nextprime
%o def A374179(n):
%o p, pb = 2, 2
%o while (q:=nextprime(p)):
%o if pb==(qb:=q.bit_length()) and (p^q).bit_count() == n:
%o return p
%o p, pb = q, qb # _Chai Wah Wu_, Jul 10 2024
%Y Cf. A000120, A000788, A007088, A061712, A205510, A374178.
%K nonn,base
%O 1,1
%A _Hugo Pfoertner_, Jul 09 2024