OFFSET
1,2
COMMENTS
Sequence is a permutation of the positive integers.
Proof that every number must eventually appear: Suppose not, let k be smallest number that never appears. Then for every a(n-1) > k, we have a(n-1)-k | k, i.e. i(a(n-1)-k) = k for some i with 1 <= i <= k. Therefore a(n-1) <= (k+ik)/k <= k(k+1). So once a(n-1) > k(k+1), we will have a(n) = k, a contradiction. - N. J. A. Sloane, Jan 29 2006
LINKS
EXAMPLE
Among those positive integers not among the first 4 integers of the sequence, a(5) = 6 is the smallest such that |a(5)-a(4)| = |6-2| = 4 does not divide a(5) =6. 4, for example, is not among the first 4 terms of the sequence, but |4-2| = 2 does divide 4. So a(5) is not 4, but is instead 6.
MATHEMATICA
f[l_] := Block[{k=1}, While[MemberQ[l, k] || Mod[k, Abs[k - Last[l]]] == 0, k++ ]; Return[Append[l, k]]; ]; Nest[f, {1}, 100] (* Ray Chandler, Nov 13 2005 *)
PROG
(Haskell)
import Data.List (delete)
a113966 n = a113966_list !! (n-1)
a113966_list = 1 : f [2..] [1] where
f xs ys'@(y:ys) = y' : f (delete y' xs) (y':ys') where
y' = head [z | z <- xs, y `mod` abs (z - y) > 0]
-- Reinhard Zumkeller, Feb 26 2013
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
Leroy Quet, Nov 10 2005
EXTENSIONS
Extended by Jim Nastos and Ray Chandler, Nov 13 2005
STATUS
approved