OFFSET
1,2
COMMENTS
This sequence is a permutation of the positive integers. After any two increases in the position of n from after the first hole, it will be possible to put the next number in that hole.
EXAMPLE
For a(n) = 2, n must be at least 3 away from a^{-1}(1) = 1, so n = 4. Next, a(n) = 3 must be 4 away from 4, so it can't be less than 4; hence a(8) = 3. Then a(n) = 4 must be 5 away from 8; the first hole at 2 is far enough, so a(2) = 4.
PROG
(PARI) dist(n) = n+1
al(n) = {local(d, v, w, mn, j);
v=vector(n); w=vector(n);
v[1]=w[1]=1; mn=2;
for(k=2, n,
d=dist(k);
if(w[k-1]-d>=mn,
j=mn; mn++; while(v[mn], mn++),
j=w[k-1]+d; while(j<=#v&v[j], j++); if(j>#v, v=vector(j, i, if(i<=#v, v[i], 0))));
v[j]=k; w[k]=j);
v}
CROSSREFS
KEYWORD
nonn
AUTHOR
Franklin T. Adams-Watters, Oct 27 2009
STATUS
approved