OFFSET
1,1
COMMENTS
Sequence is well-defined also in case there are only a finite number of Mersenne primes.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..3217
EXAMPLE
For p in A000043: 2, 3, 5, 7, 13, 17, 19, ..., a(p) = (2^p)-1, thus a(2) = 2^2 - 1 = 3, a(3) = 7, a(5) = 31, a(7) = 127, a(13) = 8191, a(17) = 131071, etc., with the rest of positions filled by the least unused prime:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ...
2, 3, 7, 5, 31, 11, 127, 13, 17, 19, 23, 29, 8191, 37, 41, 43, 131071, ...
PROG
(PARI)
up_to = 127;
A332211list(up_to) = { my(v=vector(up_to), xs=Map(), i=1, q); for(n=1, up_to, if(isprime(q=((2^n)-1)), v[n] = q, while(mapisdefined(xs, prime(i)), i++); v[n] = prime(i)); mapput(xs, v[n], n)); (v); };
v332211 = A332211list(up_to);
A332211(n) = v332211[n];
\\ For faster computing of larger values, use precomputed values of A000043:
v000043 = [2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217];
up_to = v000043[#v000043];
A332211list(up_to) = { my(v=vector(up_to), xs=Map(), i=1, q); for(n=1, up_to, if(vecsearch(v000043, n), q = (2^n)-1, while(mapisdefined(xs, prime(i)), i++); q = prime(i)); v[n] = q; mapput(xs, q, n)); (v); };
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Feb 09 2020
STATUS
approved