%I M2728 #48 Feb 24 2019 11:21:00
%S 1,3,8,18,30,43,67,90,122,161,202,260,305,388,416,450,555,624,730,750,
%T 983,1059,1159,1330,1528,1645,1774,1921,2140,2289,2580,2632,2881,3158,
%U 3304,3510,3745,4086,4563,4741,4928,5052,5407,5864,6242,6528,6739,7253
%N "Magic" integers: a(n+1) is the smallest integer m such that there is no overlap between the sets {m, m-a(i), m+a(i): 1 <= i <= n} and {a(i), a(i)-a(j), a(i)+a(j): 1 <= j < i <= n}.
%C The definition implies that the sets {a(i)} (A004210), {a(i)-a(j), j < i} (A206522) and {a(i)+a(j), j < i} (A206523) are disjoint. A206524 gives the complement of their union.
%D R. A. Bates, E. Riccomagno, R. Schwabe, H. P. Wynn, Lattices and dual lattices in optimal experimental design for Fourier models, Computational Statistics & Data Analysis Volume 28, Issue 3, 4 September 1998, Pages 283-296. See page 293.
%D D. R. Hofstadter, "Goedel, Escher, Bach: An Eternal Golden Braid", Basic Books Incorporated, p. 73
%D P. Mark Kayll, Well-spread sequences and edge-labelings with constant Hamiltonian weight, Disc. Math. & Theor. Comp. Sci 6 2 (2004) 401-408
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H T. D. Noe, <a href="/A004210/b004210.txt">Table of n, a(n) for n = 1..150</a>
%H B. G. DeBoer, <a href="/A004210/a004210.pdf">Letter to N. J. A. Sloane</a>, Dec 15 1978, with enclosure of Silvertom article.
%H J. V. Silverton, <a href="http://dx.doi.org/10.1107/S0567739478001308">On the generation of 'magic integrals'</a>, Acta Cryst. A34 (1978) p. 634.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/MagicInteger.html">Magic Integer.</a>
%F a(n+1) = min{ k | k and k +- a(i) are not equal to a(i) or a(i)-a(j) or a(i)+a(j) for any n+1 > i > j > 0}. [Corrected by _T. D. Noe_, Sep 08 2008]
%t a[1] = 1; a[n_] := a[n] = Module[{pairs = Flatten[ Table[{a[j] + a[k], a[k] - a[j]}, {j, 1, n-1}, {k, j+1, n-1}]], an = a[n-1] + 1}, While[ True, If[ Intersection[ Join[ Array[a, n-1], pairs], Prepend[ Flatten[ Table[{a[j] + an, an - a[j]}, {j, 1, n-1}]], an]] == {}, Break[], an++]]; an]; Table[a[n], {n, 1, 48}] (* _Jean-François Alcover_, Nov 10 2011 *)
%o (Haskell)
%o import Data.List (intersect)
%o a004210 n = a004210_list !! (n-1)
%o a004210_list = magics 1 [0] [0] where
%o magics :: Integer -> [Integer] -> [Integer] -> [Integer]
%o magics n ms tests
%o | tests `intersect` nMinus == [] && tests `intersect` nPlus == []
%o = n : magics (n+1) (n:ms) (nMinus ++ nPlus ++ tests)
%o | otherwise
%o = magics (n+1) ms tests
%o where nMinus = map (n -) ms
%o nPlus = map (n +) ms
%o -- magics works also as generator for a126428_list, cf. A126428.
%o -- _Reinhard Zumkeller_, Mar 03 2011
%Y Cf. A000969, A005228, A206522, A206523, A206524.
%K easy,nonn,nice
%O 1,2
%A _N. J. A. Sloane_, following a suggestion from B. G. DeBoer, Dec 15 1978
%E Additional comments from Robert M. Burton, Jr. (bob(AT)oregonstate.edu), Feb 20 2005
%E More terms from _Joshua Zucker_, May 04 2006
%E Edited by _N. J. A. Sloane_, Sep 06 2008 at the suggestion of _R. J. Mathar_
%E Edited by _N. J. A. Sloane_, Feb 08 2012