OFFSET
0,2
COMMENTS
In the set of all positive differences of the sequence each integer appears exactly once, i.e., lambda = 1.
REFERENCES
T. Baginova, R. Jajcay, Notes on subtractive properties of natural numbers, Bulletin of the ICA, Vol. 25(1999), pp. 29-40
O. Grosek, R. Jajcay, Generalized Difference Sets on an Infinite Cyclic Semigroup, JCMCC, Vol. 13 (1993), pp. 167-174.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..1000
FORMULA
Let N_1={1, 2}. Given N_i, let N_{i+1} = N_i union {2k+2, 2k+2+j} where k = max element of N_i and j = smallest number not of form x-y for x, y in N_i, x>y. Union of all N_i gives sequence.
a(A115406(n)) - a(A115407(n)) = n; a(m) - a(n) = A115409(m*(m-1)/2+n+1), 1 <= n < m. - Reinhard Zumkeller, Jan 22 2006
For n > 0: a(n) = A115409(n,1) + 1. - Reinhard Zumkeller, Sep 16 2014
MAPLE
M:= 100: # to get all differences up to M
Agenda:= Array(1..M, 1):
a[1]:= 1: a[2]:= 2: Agenda[1]:= 0:
for n from 2 by 2 do
dm:= ArrayTools:-SearchArray(Agenda, 1);
if ArrayTools:-Size(dm)[1]=0 then break fi;
dm:= dm[1];
Agenda[dm]:= 0:
a[n+1]:= 2*a[n]+2:
a[n+2]:= a[n+1] + dm;
for j from n by -1 to 1 while a[n+1] - a[j] <= M do
Agenda[a[n+1]-a[j]]:= 0;
if a[n+2]-a[j] <= M then Agenda[a[n+2]-a[j]]:= 0 fi
od:
od:
seq(a[i], i=1..n); # Robert Israel, Oct 08 2015
MATHEMATICA
differenceQ[seq_, x_] := (r = False; Do[ If[ x == seq[[k]] - seq[[j]], r = True; Break[]], { j, 1, Length[seq] }, {k, 1, Length[seq] } ]; r); seq[1] = {1, 2}; seq[i_] := seq[i] = (k = Max[ seq[i-1] ]; j = First[ Select[ Range[k], !differenceQ[ seq[i-1], #] & , 1]]; Union[ seq[i-1], {2k+2, 2k+2+j} ] ); A024431 = seq[20] (* Jean-François Alcover, Jan 04 2012 *)
PROG
(Haskell)
import Data.List ((\\))
a024431 n = a024431_list !! n
a024431_list = 1 : 2 : f [2, 1] [2 ..] where
f ks@(k:_) (j:js) =
x : y : f (y : x : ks) ((js \\ map (y -) ks) \\ map (x -) ks)
where y = x + j; x = 2 * k + 2
-- Reinhard Zumkeller, Sep 16 2014
CROSSREFS
KEYWORD
nonn,nice,easy
AUTHOR
Otokar Grosek (grosek(AT)elf.stuba.sk)
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), May 04 2000
STATUS
approved