OFFSET
1,2
COMMENTS
A variant of Recamán's sequence: start at n=1, a(1)=1, then iterate: let n' = n - a(n) if this n' > 0 and was not visited earlier, otherwise n' = n + a(n). Then let n'' <> n' be the smallest index not visited earlier (a(n'') not yet defined) such that the value |n'-n''| was not yet used (meaning not yet a value of any a(i)). Set a(n') = |n'-n''| and continue with n = n'. [Name and Comment suggested by M. F. Hasler at the request of the authors.]
Conjectured to be a permutation of the positive integers. The conjectured inverse permutation is given in A308049. - M. F. Hasler, May 10 2019
Comment from Rémy Sigrist and N. J. A. Sloane, May 13 2019 (Start):
The sequence is given by the following formula. Let R(t) = A081145(t). Then for all t >= 1, a(R(t)) = |R(t+1)-R(t)|.
For example, for t=10, R(10)=20, R(11)=6, and a(R(10)) = a(20) = |6-20| = 14.
Since it is known that {R(t): t>=1} is a permutation of the positive integers (it is the "Slater-Velez permutation of the first kind"), this specifies a(n) for all n.
The connection with the definition as interpreted above by M. F. Hasler is that at step t of the procedure, n' is R(t) = A081145(t), n'' is R(t+1) = A081145(t+1), and we calculate a(R(t)) = |n'-n''| = |R(t)-R(t+1)|.
The conjecture that {a(n)} is a permutation of the positive integers is equivalent to Slater and Velez's conjecture (see references) that the absolute values of the first differences of A081145 are also a permutation of the positive integers. This problem appears to be still unsolved. (End)
REFERENCES
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.
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.
William Y. Velez, Research problems 159-160, Discrete Math., 110 (1992), pp. 301-302.
EXAMPLE
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.
PROG
(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
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Jean-Marc Falcoz, May 09 2019
STATUS
approved