OFFSET
1,2
COMMENTS
The sequence is a permutation of the positive integers. The inverse is A081146.
Similar to A100707, except that when we subtract we use the largest possible k.
The 1977 paper of Slater and Velez proves that this sequence is a permutation of positive integers and conjectures that its absolute difference sequence (see A308007) is also a permutation. If we call this the "Slater-Velez permutation of the first kind", then they also constructed another permutation (the 2nd kind), for which they are able to prove that both the sequence (A129198) and its absolute difference (A129199) are true permutations. - Ferenc Adorjan, Apr 03 2007
The points appear to lie on three straight lines of slopes roughly 0.56, 1.40, 2.24 (click "graph", or see the Wilks link). I checked this for the first 10^6 terms using Allan Wilks's C program. See A308009-A308015 for further information about the three lines. - N. J. A. Sloane, May 14 2019
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
Ferenc Adorjan, Table of n,a(n) for n = 1..5000
Shalosh B. Ekhad and Doron Zeilberger, Guessing the Elusive Patterns in the Slater-Valez sequence (aka OEIS A081145), June 2019; Local copy
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.
Allan Wilks, Table showing n, a(n), slope, line_number, for n=1..100000 [The three lines are labeled 0 (lower), 1 (middle), 2 (upper).]
Allan Wilks, C program for A081145
EXAMPLE
a(4)=7 because the previous term is 4 and the differences |3-4|, |5-4| and |6-4| have already occurred.
After 7 we get 3 as the difference 4 has not occurred earlier. 5 follows 14 as the difference 9 has not occurred earlier.
MATHEMATICA
f[s_] := Block[{d = Abs[Rest@s - Most@s], k = 1}, While[ MemberQ[d, Abs[k - Last@s]] || MemberQ[s, k], k++ ]; Append[s, k]]; NestList[s, {1}, 70] (* Robert G. Wilson v, Jun 09 2006 *)
f[s_] := Block[{k = 1, d = Abs[Most@s - Rest@s], l = Last@s}, While[MemberQ[s, k] || MemberQ[d, Abs[l - k]], k++ ]; Append[s, k]]; Nest[f, {1}, 70] (* Robert G. Wilson v, Jun 13 2006 *)
PROG
(PARI){SV_p1(n)=local(x, v=6, d=2, j, k); /* Slater-Velez permutation - the first kind (by F. Adorjan)*/ x=vector(n); x[1]=1; x[2]=2; for(i=3, n, j=3; k=1; while(k, if(k=bittest(v, j)||bittest(d, abs(j-x[i-1])), j++, v+=2^j; d+=2^abs(j-x[i-1]); x[i]=j))); return(x)} \\ Ferenc Adorjan, Apr 03 2007
(Python)
A081145_list, l, s, b1, b2 = [1, 2], 2, 3, set(), set([1])
for n in range(3, 10**2):
i = s
while True:
m = abs(i-l)
if not (i in b1 or m in b2):
A081145_list.append(i)
b1.add(i)
b2.add(m)
l = i
while s in b1:
b1.remove(s)
s += 1
break
i += 1 # Chai Wah Wu, Dec 15 2014
(Haskell)
import Data.List (delete)
a081145 n = a081145_list !! (n-1)
a081145_list = 1 : f 1 [2..] [] where
f x vs ws = g vs where
g (y:ys) = if z `elem` ws then g ys else y : f y (delete y vs) (z:ws)
where z = abs (x - y)
-- Reinhard Zumkeller, Jul 02 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Don Reble, Mar 08 2003
STATUS
approved