cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A332211 Lexicographically earliest permutation of primes such that a(n) = 2^n - 1 when n is one of the Mersenne prime exponents (in A000043).

This page as a plain text file.
%I A332211 #26 Feb 09 2020 20:12:45
%S A332211 2,3,7,5,31,11,127,13,17,19,23,29,8191,37,41,43,131071,47,524287,53,
%T A332211 59,61,67,71,73,79,83,89,97,101,2147483647,103,107,109,113,131,137,
%U A332211 139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,2305843009213693951,269,271,277,281,283,293,307,311,313
%N A332211 Lexicographically earliest permutation of primes such that a(n) = 2^n - 1 when n is one of the Mersenne prime exponents (in A000043).
%C A332211 Sequence is well-defined also in case there are only a finite number of Mersenne primes.
%H A332211 Antti Karttunen, <a href="/A332211/b332211.txt">Table of n, a(n) for n = 1..3217</a>
%F A332211 For all applicable n >= 1, a(A000043(n)) = A000668(n).
%e A332211 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:
%e A332211 1, 2, 3, 4,  5,  6,   7,  8,  9, 10, 11, 12,   13, 14, 15, 16, 17, ...
%e A332211 2, 3, 7, 5, 31, 11, 127, 13, 17, 19, 23, 29, 8191, 37, 41, 43, 131071, ...
%o A332211 (PARI)
%o A332211 up_to = 127;
%o A332211 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); };
%o A332211 v332211 = A332211list(up_to);
%o A332211 A332211(n) = v332211[n];
%o A332211 \\ For faster computing of larger values, use precomputed values of A000043:
%o A332211 v000043 = [2,3,5,7,13,17,19,31,61,89,107,127,521,607,1279,2203,2281,3217];
%o A332211 up_to = v000043[#v000043];
%o A332211 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); };
%Y A332211 Cf. A000040, A000043, A000668, A332210 (inverse permutation of primes), A332220.
%Y A332211 Used to construct permutations A332212, A332214.
%K A332211 nonn
%O A332211 1,1
%A A332211 _Antti Karttunen_, Feb 09 2020