OFFSET
1,2
COMMENTS
Sequence is a permutation of the positive integers.
LINKS
EXAMPLE
Among those positive integers not among the first 4 integers of the sequence, a(5) = 5 is the lowest such that |a(5)-a(4)| = |5-2| = 3 does not divide (a(5)+a(4)) = 5+2 = 7. 3, for example, is not among the first 4 terms of the sequence, but |3-2| = 1 does indeed divide (3+2). So a(5) is not 3, but is instead 5.
MATHEMATICA
f[l_] := Block[{k=1, m}, m = Last[l]; While[MemberQ[l, k] || Mod[m + k, Abs[k - m]] == 0, k++ ]; Return[Append[l, k]]; ]; Nest[f, {1}, 100] (* Ray Chandler, Nov 13 2005 *)
PROG
(Haskell)
import Data.List (delete)
a113963 n = a113963_list !! (n-1)
a113963_list = 1 : f 1 [2..] where
f z xs = g xs where
g (y:ys) = if (y + z) `mod` abs (y - z) > 0
then y : f y (delete y xs) else g ys
-- Reinhard Zumkeller, Sep 04 2014
(Python)
A113963 = [1]
for n in range(1, 10**2):
....a, b = 1, A113963[-1]
....while a in A113963 or not (a+b) % (a-b):
........a += 1
....A113963.append(a) # Chai Wah Wu, Sep 05 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Nov 10 2005
EXTENSIONS
Extended by Ray Chandler, Nov 13 2005
STATUS
approved