[go: up one dir, main page]

login
A182115
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
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, 27, 26, 28, 30, 31, 32, 37, 33, 34, 35, 36, 38, 41, 39, 40, 42, 43, 44, 47, 45, 46, 48, 49, 50, 51, 52, 53, 59, 54, 55, 57, 56, 58, 60, 62, 63, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73
OFFSET
1,2
COMMENTS
a(n+a(n)+1) is the term reached by "jumping over" a(n) terms to the right of a(n).
LINKS
EXAMPLE
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.
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).
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).
PROG
(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
CROSSREFS
Cf. A182113.
Sequence in context: A061728 A332017 A276127 * A362962 A065182 A060120
KEYWORD
nonn
AUTHOR
Eric Angelini, Apr 12 2012
STATUS
approved