

A182113


Lexicographically earliest permutation of the positive integers such that a(n+a(n)+1) has the same parity as a(n).


1



1, 2, 3, 4, 6, 7, 5, 8, 10, 11, 9, 12, 13, 15, 16, 14, 18, 19, 17, 20, 21, 23, 24, 22, 26, 27, 25, 28, 29, 31, 32, 30, 33, 34, 35, 36, 37, 39, 40, 38, 42, 43, 41, 44, 45, 47, 48, 46, 49, 50, 51, 52, 53, 55, 56, 54, 58, 59, 57, 60, 61, 63, 64, 62, 65, 66, 67, 68, 70, 71, 69, 72, 74, 75, 73
(list;
graph;
refs;
listen;
history;
text;
internal format)



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 we will land on a(3) which must have the same parity as a(1).
a(2)=2 means that jumping over a(3), a(4), we will land on a(5) which must be even, as is a(2). Therefore a(5) cannot equal 5 (which would be the least available number not yet used), the least possible choice is a(5)=6 (after having filled in a(3) with the least unused odd number, and a(4) with the least unused number without restriction).


PROG

(PARI) {R=vector(222); u=0; for(n=1, 100, a=0; while( bittest(u, a++)  (R[n] &(a+R[n])%2)  (R[n+a+1] & (a+R[n+a+1])%2), ); u+=1<<R[n]=a; R[n+a+1]=bittest(a, 0)2); vecextract(R, "1..100")}


CROSSREFS



KEYWORD

nonn


AUTHOR



STATUS

approved



