login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Angry numbers: each number n must be more than n places from n-1 and n+1. This sequence places each number as early as possible.
1

%I #2 Mar 30 2012 17:35:24

%S 1,4,7,2,10,13,16,3,5,19,22,8,25,28,31,6,11,34,37,40,14,9,43,46,17,49,

%T 52,55,58,12,20,61,64,67,23,70,15,73,76,26,79,82,85,18,29,88,91,32,94,

%U 97,100,103,21,35,106,109,112,38,115,24,118,41,121,124,127,130,133,27

%N Angry numbers: each number n must be more than n places from n-1 and n+1. This sequence places each number as early as possible.

%C 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.

%e 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.

%o (PARI) dist(n) = n+1

%o al(n) = {local(d,v,w,mn,j);

%o v=vector(n);w=vector(n);

%o v[1]=w[1]=1;mn=2;

%o for(k=2,n,

%o d=dist(k);

%o if(w[k-1]-d>=mn,

%o j=mn;mn++;while(v[mn],mn++),

%o j=w[k-1]+d;while(j<=#v&v[j],j++);if(j>#v,v=vector(j,i,if(i<=#v,v[i],0))));

%o v[j]=k;w[k]=j);

%o v}

%Y Cf. A072009, A065187, A167048, A167047

%K nonn

%O 1,2

%A _Franklin T. Adams-Watters_, Oct 27 2009