OFFSET
2,1
LINKS
Chai Wah Wu, Table of n, a(n) for n = 2..1000
PROG
(PARI) for(n=2, 10, my(hmin=n+n, pmax); forprime(p=2^(n-1), 2^n, my(h=hammingweight(p)); if(h<=hmin, pmax=p; hmin=h)); print1(pmax, ", "))
(Python)
from sympy import isprime
from sympy.utilities.iterables import multiset_permutations
def A333876(n):
for i in range(n):
q = 2**n-1
for d in multiset_permutations('0'*i+'1'*(n-1-i)):
p = q-int(''.join(d), 2)
if isprime(p):
return p # Chai Wah Wu, Apr 08 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Hugo Pfoertner, Apr 08 2020
STATUS
approved