A002858 Ulam numbers: a(1) = 1; a(2) = 2; for n>2, a(n) = least number > a(n-1) which is a unique sum of two distinct earlier terms.
1, 2, 3, 4, 6, 8, 11, 13, 16, 18, 26, 28, 36, 38, 47, 48, 53, 57, 62, 69, 72, 77, 82, 87, 97, 99, 102, 106, 114, 126, 131, 138, 145, 148, 155, 175, 177, 180, 182, 189, 197, 206, 209, 219, 221, 236, 238, 241, 243, 253, 258, 260, 273, 282, 309, 316, 319, 324, 339
Offset: 1
References
- Steven R. Finch, Mathematical Constants, Cambridge, 2003, Section 2.16.2.
- Richard K. Guy, Unsolved Problems in Number Theory, C4.
- Donald E. Knuth, The Art of Computer Programming, Volume 4A, Section 7.1.3.
- N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
- James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 116.
- Marvin C. Wunderlich, The improbable behavior of Ulam's summation sequence, pp. 249-257 of A. O. L. Atkin and B. J. Birch, editors, Computers in Number Theory. Academic Press, NY, 1971.
- David Zeitlin, Ulam's sequence {U_n}, U_1=1, U_2=2, is a complete sequence, Notices Amer. Math. Soc., 22 (No. 7, 1975), Abstract 75T-A267, p. A-707.
Links
- Jud McCranie, Table of n, a(n) for n = 1..10000
- Richard A. Becker, Plot of residuals a(n) - 13.5167*n for n <= 3000000, postscript file [uses Jud McCranie's values of a(n)].
- Richard A. Becker, Plot of residuals a(n) - 13.5167*n for n <= 3000000, pdf file [uses Jud McCranie's values of a(n)].
- Thomas Bloom, Problem 342, Erdős Problems.
- Henning Fernau and Kshitij Gajjar, The Space Complexity of Sum Labelling, arXiv:2107.12973 [cs.DS], 2021.
- Steven R. Finch, Ulam s-Additive Sequences. [From Steven Finch, Apr 20 2019]
- Steven R. Finch, Stolarsky-Harborth Constant.
- Steven R. Finch, Stolarsky-Harborth Constant. [From the Wayback machine]
- Philip Gibbs, An Efficient Way to Compute Ulam Numbers.
- Philip Gibbs, A Conjecture for Ulam Sequences.
- Philip Gibbs and Judson McCranie, The Ulam Numbers up to One Trillion, (2017).
- Shyam Sunder Gupta, Ulam Numbers. In: Exploring the Beauty of Fascinating Numbers. Springer Praxis Books(). Springer, Singapore, (2025).
- Alois P. Heinz, Ulam spiral of Ulam numbers.
- Donald E. Knuth, Downloadable programs
- Noah Kravitz and Stefan Steinerberger, Ulam Sequences and Ulam Sets, arXiv:1705.01883 [math.CO], 2017.
- Borys Kuca, Structures in Additive Sequences, arXiv:1804.09594 [math.NT], 2018. See p. 3.
- Jud McCranie, Density 10^2 to 10^12
- Jud McCranie, Density 10^4 to 10^12
- Jud McCranie, Density 10^6 to 10^12
- J. W. Moon, R. K. Guy, and N. J. A. Sloane, Correspondence, 1973.
- Ed Pegg, Jr., Graph of 10^6 terms of a(n) - 13.5*n.
- Popular Computing (Calabasas, CA), Sieves: Problem 43, Vol. 2 (No. 13, Apr 1974), pp. 6-7. This is Sieve #8. [Annotated and scanned copy]
- R. Queneau, Sur les suites s-additives, J. Combin. Theory, A12 (1972), 31-71.
- Bernardo Recamán, Questions on a sequence of Ulam, Amer. Math. Monthly, Vol. 80, No. 8 (1973), pp. 919-920.
- Ivano Salvo and Agnese Pacifico, Computing Integer Sequences: Filtering vs Generation (Functional Pearl), arXiv:1807.11792 [cs.PL], 2018.
- James Schmerl and Eugene Spiegel, The regularity of some 1-additive sequences, J. Combin. Theory. Ser. A, Vol. 66, No. 1 (1994), pp. 172-175. Math. Rev. 95h:11010.
- Arseniy Sheydvasser, The Ulam Sequence of the Integer Polynomial Ring, arXiv:1910.00109 [math.NT], 2019.
- N. J. A. Sloane, Handwritten notes on Self-Generating Sequences, 1970 (note that A1148 has now become A005282).
- Arseniy (Senia) Sheydvasser, The Ulam Sequence of Linear Integer Polynomials, J. Int. Seq., Vol. 24 (2021), Article 21.10.8.
- Stefan Steinerberger, A hidden signal in the Ulam sequence, Research Report YALEU/DCS/TR-1508, Yale University, 2015.
- Stefan Steinerberger, A hidden signal in the Ulam sequence, Figure 2 from Research Report YALEU/DCS/TR-1508, Yale University, 2015.
- Stefan Steinerberger, The Ulam Sequence, blog post, April 12, 2016.
- Stanislaw M. Ulam, On some mathematical problems connected with patterns of growth of figures, pp. 215-224 of R. E. Bellman, ed., Mathematical Problems in the Biological Sciences, Proc. Sympos. Applied Math., Vol. 14, Amer. Math. Soc., 1962 [Annotated scanned copy]
- Stanislaw Ulam, Combinatorial analysis in infinite sets and some physical theories, SIAM Rev., Vol. 6, No. 4 (1964), pp. 343-355. Reprinted in Selected Papers, MIT Press, see p. 393.
- Eric Weisstein's World of Mathematics, Ulam Sequence.
- Wikipedia, Ulam number.
- David W. Wilson, Plot of initial terms, showing their quasiperiodicity as vertical bars. The image width was chosen to include approximately 10 periods. For an explanation of this picture, see Comments above.
- Robert G. Wilson v, Letter to N. J. A. Sloane, Sep. 1992.
- David Zeitlin, Ulam's sequence {U_n}, U_1=1, U_2=2, is a complete sequence, Notices Amer. Math. Soc., 22 (No. 7, 1975), Abstract 75T-A267, p. A-707. (Annotated scanned copy)
- Index entries for Ulam numbers
Crossrefs
Programs
-
Haskell
a002858 n = a002858_list !! (n-1) a002858_list = 1 : 2 : ulam 2 2 a002858_list ulam :: Int -> Integer -> [Integer] -> [Integer] ulam n u us = u' : ulam (n + 1) u' us where u' = f 0 (u+1) us' f 2 z _ = f 0 (z + 1) us' f e z (v:vs) | z - v <= v = if e == 1 then z else f 0 (z + 1) us' | z - v `elem` us' = f (e + 1) z vs | otherwise = f e z vs us' = take n us -- Reinhard Zumkeller, Nov 03 2011
-
Julia
function isUlam(u, n, h, i, r) h == 2 && return false ur = u[r]; ui = u[i] ur <= ui && return h == 1 if ur + ui > n r -= 1 elseif ur + ui < n i += 1 else h += 1; i += 1; r -= 1 end isUlam(u, n, h, i, r) end function UlamList(len) u = Array{Int, 1}(undef, len) u[1] = 1; u[2] = 2; i = 2; n = 2 while i < len n += 1 if isUlam(u, n, 0, 1, i) i += 1 u[i] = n end end return u end println(UlamList(59)) # Peter Luschny, Apr 07 2019
-
Maple
UlamList := proc(len) local isUlam, nextUlam, behead; behead := u -> u[2..numelems(u)]; isUlam := proc(n, h, u, r) local hu, tu, hr, tr; hu := u[1]; hr := r[1]; if h = 2 then return false fi; if hr <= hu then return evalb(h = 1) fi; if (hr + hu) = n then tu := behead(u); tr := behead(r); return isUlam(n, h+1, tu, tr) fi; if (hr + hu) < n then tu := behead(u): return isUlam(n, h, tu, r) fi; tr := behead(r); isUlam(n, h, u, tr) end: nextUlam := proc(n, u, r) if isUlam(n, 0, u, r) then if nops(u) = len-1 then return [op(u), n] fi; nextUlam(n+1, [op(u), n], [n, op(r)]) else nextUlam(n+1, u, r) fi end: nextUlam(3, [1, 2], [2, 1]) end: UlamList(59); # Peter Luschny, Apr 05 2019
-
Mathematica
Ulam4Compiled = Compile[{{nmax, _Integer}, {init, _Integer, 1}, {s, _Integer}}, Module[{ulamhash = Table[0, {nmax}], ulam = init}, ulamhash[[ulam]] = 1; Do[ If[Quotient[Plus @@ ulamhash[[i - ulam]], 2] == s, AppendTo[ulam, i]; ulamhash[[i]] = 1], {i, Last[init] + 1, nmax}]; ulam]]; ulams = Ulam4Compiled[355, {1, 2}, 1] (* Second program: *) ulams = {1, 2}; Do[AppendTo[ulams, n = Last[ulams]; While[n++; Length[DeleteCases[Intersection[ulams, n - ulams], n/2, 1, 1]] != 2]; n], {100}]; ulams (* Jean-François Alcover, Sep 08 2011 *) findUlams[s_List, j_Integer] := Block[{k = s[[-1]] + 1, ss = Plus @@@ Subsets[s, {j}]}, While[ Count[ss, k] != 1, k++]; Append[s, k]]; ulams = Nest[findUlams[#, 2] &, {1, 2}, 70] (* Robert G. Wilson v, Jul 05 2014 *)
-
PARI
aupto(N)= my(seen=vector(N), U=[]); seen[1]=seen[2]=1; for(i=1,N, if(1==seen[i], for(j=1,#U, my(sum=i+U[j]); if(sum>N, break); seen[sum]++); U=concat(U,i))); U \\ Ruud H.G. van Tol, Dec 29 2022
-
Python
def isUlam(n, h, u, r): if h == 2: return False hu = u[0]; hr = r[0] if hr <= hu: return h == 1 if hr + hu > n: r = r[1:] elif hr + hu < n: u = u[1:] else: h += 1; r = r[1:]; u = u[1:] return isUlam(n, h, u, r) def UlamList(length): u = [1, 2]; r = [2, 1]; n = 2 while len(u) < length: n += 1 if isUlam(n, 0, u[:], r[:]): u.append(n); r.insert(0, n) return u print(UlamList(59)) # Peter Luschny, Apr 06 2019
Extensions
More terms from Jud McCranie
Comments