|
|
A180024
|
|
Smallest prime greater than n-th prime having as many ones in binary representation.
|
|
3
|
|
|
5, 17, 11, 13, 19, 257, 37, 29, 43, 47, 41, 67, 53, 59, 71, 61, 79, 73, 83, 97, 103, 89, 101, 131, 113, 107, 109, 151, 139, 191, 137, 193, 149, 163, 157, 167, 197, 173, 179, 181, 199, 223, 521, 263, 211, 227, 239, 229, 233, 241, 251, 271, 367, 65537, 269, 277, 283
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
2,1
|
|
COMMENTS
|
If A000040(6543)=A019434(5)=65537 is the last Fermat prime, the sequence is finite with last term a(6542)=73471.
|
|
LINKS
|
|
|
EXAMPLE
|
n=10: prime(10) = 29->11101 with 4 ones,
a(10) = prime(14) = 43->101011;
n=100: prime(100) = 541->1000011101 with 5 ones,
a(100) = prime(102) = 557->1000101101;
n=1000: prime(1000) = 7919->1111011101111 with 11 ones,
a(1000) = prime(1001) = 7927->1111011110111;
n=6542: prime(6542) = 65521->1111111111110001 with 13 ones,
a(6542) = prime(7255) = 73471->10001111011111111;
n=6543: prime(6543) = 65537->10000000000000001 with 2 ones,
a(6543) = unknown.
|
|
MATHEMATICA
|
sp1b[n_]:=Module[{o=DigitCount[n, 2, 1], p=NextPrime[n]}, While[ DigitCount[ p, 2, 1]!=o, p = NextPrime[ p]]; p]; sp1b/@Prime[Range[2, 60]] (* Harvey P. Dale, May 02 2019 *)
|
|
PROG
|
(PARI) a(n) = my(p=prime(n), x=hammingweight(p), q=nextprime(p+1)); while (hammingweight(q) != x, q=nextprime(q+1)); q; \\ Michel Marcus, Nov 12 2023
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|