OFFSET
1,5
PROG
(PARI) min1s(p)=my(o=znorder(Mod(2, p)), v1=Set(powers(Mod(2, p), o)), v=v1, s=1); while(!setsearch(v, Mod(0, p)), v=setbinop((x, y)->x+y, v, v1); s++); s
a(n, p=prime(n))=my(m=min1s(p), t=p, k=2*p); while(hammingweight(t)>m, t+=k); t/p
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Charles R Greathouse IV, Dec 02 2016
STATUS
approved