login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Lexicographically earliest permutation of the positive integers such that a(n+a(n)+1) is prime if and only if a(n) is prime.
1

%I #11 Dec 23 2024 14:53:42

%S 1,2,4,5,3,6,7,8,11,13,10,9,12,14,17,15,16,18,19,20,23,21,22,29,24,25,

%T 27,26,28,30,31,32,37,33,34,35,36,38,41,39,40,42,43,44,47,45,46,48,49,

%U 50,51,52,53,59,54,55,57,56,58,60,62,63,61,64,65,66,67,68,69,70,71,72,73

%N Lexicographically earliest permutation of the positive integers such that a(n+a(n)+1) is prime if and only if a(n) is prime.

%C a(n+a(n)+1) is the term reached by "jumping over" a(n) terms to the right of a(n).

%H E. Angelini, <a href="https://web.archive.org/web/*/http://list.seqfan.eu/oldermail/seqfan/2012-April/016773.html">Small perturbations in the natural flow</a>, SeqFan list, Apr 12 2012

%e a(1)=1 means that jumping over its neighbor a(2) we will land on a(3) which must not be prime, since a(1) is not. Therefore a(3) cannot equal 3, the least possibility is a(3)=4.

%e a(2)=2 means that jumping over a(3), a(4), we will land on a(5) which must be prime, as is a(2).

%e a(4) is not restricted and the smallest unused number is 3, but we cannot have a(4)=3 since then, jumping over 3 terms we get to a(4+3+1)=a(8) which would also have to be prime, but a(3)=4 already imposed that a(3+4+1) is composite as a(3). Therefore the smallest possibility is a(4)=5, and the (prime) number 3 will be used for a(5).

%o (PARI) {S=vector(222);u=0; for(n=1,100, a=0; while( bittest(u,a++) || (S[n] & 2^isprime(a)+S[n]) || (S[n+a+1] & 2^isprime(a)+S[n+a+1]),); u+=1<<S[n]=a; S[n+a+1]=-2^isprime(a)); vecextract(S,"1..100")} \\ - _M. F. Hasler_, Apr 12 2012

%Y Cf. A182113.

%K nonn

%O 1,2

%A _Eric Angelini_, Apr 12 2012