cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A024431 A generalized difference set on the set of all integers (lambda = 1).

This page as a plain text file.
%I A024431 #29 Oct 09 2015 05:19:04
%S A024431 1,2,6,8,18,21,44,52,106,115,232,243,488,502,1006,1024,2050,2071,4144,
%T A024431 4166,8334,8358,16718,16743,33488,33515,67032,67060,134122,134151,
%U A024431 268304,268334,536670,536702,1073406,1073439,2146880,2146915,4293832
%N A024431 A generalized difference set on the set of all integers (lambda = 1).
%C A024431 In the set of all positive differences of the sequence each integer appears exactly once, i.e., lambda = 1.
%D A024431 T. Baginova, R. Jajcay, Notes on subtractive properties of natural numbers, Bulletin of the ICA, Vol. 25(1999), pp. 29-40
%D A024431 O. Grosek, R. Jajcay, Generalized Difference Sets on an Infinite Cyclic Semigroup, JCMCC, Vol. 13 (1993), pp. 167-174.
%H A024431 Reinhard Zumkeller, <a href="/A024431/b024431.txt">Table of n, a(n) for n = 0..1000</a>
%F A024431 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.
%F A024431 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
%F A024431 For n > 0: a(n) = A115409(n,1) + 1. - _Reinhard Zumkeller_, Sep 16 2014
%p A024431 M:= 100: # to get all differences up to M
%p A024431 Agenda:= Array(1..M,1):
%p A024431 a[1]:= 1: a[2]:= 2: Agenda[1]:= 0:
%p A024431 for n from 2 by 2 do
%p A024431   dm:= ArrayTools:-SearchArray(Agenda,1);
%p A024431   if ArrayTools:-Size(dm)[1]=0  then break fi;
%p A024431   dm:= dm[1];
%p A024431   Agenda[dm]:= 0:
%p A024431   a[n+1]:= 2*a[n]+2:
%p A024431   a[n+2]:= a[n+1] + dm;
%p A024431   for j from n by -1 to 1 while a[n+1] - a[j] <= M do
%p A024431     Agenda[a[n+1]-a[j]]:= 0;
%p A024431     if a[n+2]-a[j] <= M then Agenda[a[n+2]-a[j]]:= 0 fi
%p A024431   od:
%p A024431 od:
%p A024431 seq(a[i],i=1..n); # _Robert Israel_, Oct 08 2015
%t A024431 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 *)
%o A024431 (Haskell)
%o A024431 import Data.List ((\\))
%o A024431 a024431 n = a024431_list !! n
%o A024431 a024431_list = 1 : 2 : f [2, 1] [2 ..] where
%o A024431    f ks@(k:_) (j:js) =
%o A024431      x : y : f (y : x : ks) ((js \\ map (y -) ks) \\ map (x -) ks)
%o A024431      where y = x + j; x = 2 * k + 2
%o A024431 -- _Reinhard Zumkeller_, Sep 16 2014
%Y A024431 Cf. A005282, A049399, A115408, A115409.
%Y A024431 Cf. A247414 (first differences).
%K A024431 nonn,nice,easy
%O A024431 0,2
%A A024431 Otokar Grosek (grosek(AT)elf.stuba.sk)
%E A024431 More terms from Larry Reeves (larryr(AT)acm.org), May 04 2000