A308021 Start at n=1. Fill in a(n) with a value d > 0 not used earlier such that n-d or n+d is the smallest possible index not visited earlier, then continue with that index.
1, 2, 5, 3, 7, 10, 4, 6, 12, 15, 17, 8, 20, 9, 22, 11, 25, 27, 29, 14, 13, 33, 35, 37, 16, 40, 18, 19, 42, 45, 47, 49, 21, 24, 52, 55, 23, 58, 61, 62, 30, 26, 65, 66, 28, 68, 34, 31, 71, 74, 76, 79, 81, 39, 32, 83, 86, 36, 89, 43, 38, 91, 93, 96, 99, 41, 101, 50, 103, 106, 44, 108, 54, 111, 46, 113, 117, 48, 57, 118, 51, 120, 123
Offset: 1
Keywords
Examples
a(1) = 1 drives us to the empty cell a(2) since we can't go further to the left. We fill this cell with the number 2 which is the smallest integer not used before and thus allows us to go to the leftmost possible empty cell, 2 + 2 = 4. (There are no empty places to the left and we can't go to 3 = 2 + 1 since a step 1 has already been used.) So we have a(2) = 2. a(2) = 2 drives us to the empty cell a(4). We see that the leftmost empty cell a(3) cannot be reached from a(4) since a step of 1 has already been used. We thus fill the cell a(4) with the smallest integer not used before, a(4) = 3. a(4) = 3 drives us to the empty cell a(7). We see that the leftmost empty cell a(3) can now be reached from a(7) if we fill a(7) with 4; we have thus a(7) = 4. a(7) = 4 drives us to the empty cell a(3), which is the one we wanted to fill. We fill a(3) with 5 which is the smallest integer not leading to a contradiction, whence a(3) = 5. a(3) = 5 drives us to the empty cell a(8). We would like to fill this cell with 3, as this 3 would allow us to fill the leftmost empty cell of the sequence - but 3 has been used before; thus we'll have a(8) = 6. a(8) = 6 drives us to the empty cell a(14). We fill a(14) with 9 as this will allow us to reach the leftmost empty cell of the sequence, whence a(14) = 9. a(14) = 9 drives us to the empty cell a(5). We fill a(5) with 7 as this is the smallest integer not leading to a contradiction, so we have a(5) = 7, etc.
Links
- Jean-Marc Falcoz, Table of n, a(n) for n = 1..5564
- P. J. Slater and W. Y. Velez, Permutations of the Positive Integers with Restrictions on the Sequence of Differences, Pacific Journal of Mathematics, Vol. 71, No. 1, 1977, 193-196.
- P. J. Slater and W. Y. Velez, Permutations of the Positive Integers with Restrictions on the Sequence of Differences, II, Pacific Journal of Mathematics, Vol. 82, No. 2, 1979, 527-531.
- William Y. Velez, Research problems 159-160, Discrete Math., 110 (1992), pp. 301-302.
Crossrefs
Programs
-
PARI
{A=vector(N=199); n=1; while (n<=N,S=Set(A); Z=select(t->!t,A,1); for (i=1,#Z,Z[i]!=n||next; setsearch(S, abs(n-z=Z[i]))&& next; A[n]=abs(n-z); n=z; next(2)); break); if(#Z, A[1..Z[1]-!A[Z[1]]], A)} \\ M. F. Hasler, May 09 2019
Comments