login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A167047 Angry numbers: each number n must be more than n places from n-1 and n+1. This sequence makes each number as small as possible as it occurs. 1
1, 3, 5, 7, 9, 2, 11, 13, 4, 15, 17, 6, 19, 21, 8, 23, 25, 27, 10, 29, 31, 12, 33, 35, 37, 14, 39, 41, 16, 43, 45, 47, 18, 49, 51, 20, 53, 55, 57, 22, 59, 61, 24, 63, 65, 26, 67, 69, 71, 28, 73, 75, 30, 77, 79, 81, 32, 83, 85, 34, 87, 89, 36, 91, 93, 95, 38, 97, 99, 40, 101, 103 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

This sequence is a permutation of the positive integers. A number cannot remain unassigned indefinitely; eventually the placement gets far enough from its neighbors and it gets used.

Each term in this sequence is either the next unused even number or the next unused odd number; after the initial 5 terms there are always 2 or 3 odd numbers between each pair of even numbers.

LINKS

Table of n, a(n) for n=1..72.

EXAMPLE

After a(1) = 1, we cannot have a(2) = 2, because then 1 and 2 would be too close. a(2) = 3 is OK. Now a(3) can't be 2 because then 2 and 3 would be too close; 4 would also be too close to 3, but 5 is OK. Skipping ahead, a(6) is the first place where 2 is not too close to 3, so a(6) = 2.

PROG

(PARI) dist(n) = n+1

al(n)= {local(v, w, mn, ok);

v=vector(n); w=vector(2*n); u=vector(n);

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

for(k=2, n,

j=mn-1; ok=0;

while(!ok,

j++; ok=w[j]==0;

if(ok&w[j-1]&abs(k-w[j-1])<dist(j), ok=0);

if(ok&w[j+1]&abs(k-w[j+1])<dist(j+1), ok=0));

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

while(w[mn], mn++);

v}

CROSSREFS

Cf. A167046, A167049.

Sequence in context: A131669 A004155 A163125 * A065271 A213542 A029657

Adjacent sequences:  A167044 A167045 A167046 * A167048 A167049 A167050

KEYWORD

nonn

AUTHOR

Franklin T. Adams-Watters, Oct 27 2009

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 28 17:54 EST 2021. Contains 349415 sequences. (Running on oeis4.)