login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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.
(Formerly M0557 N0201)
102

%I M0557 N0201 #267 Mar 27 2024 13:06:55

%S 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,

%T 99,102,106,114,126,131,138,145,148,155,175,177,180,182,189,197,206,

%U 209,219,221,236,238,241,243,253,258,260,273,282,309,316,319,324,339

%N 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.

%C Ulam conjectured that this sequence has density 0. However, calculations up to 6.759*10^8 (_Jud McCranie_) indicate that the density hovers near 0.074.

%C A plot of the first 3 million terms shows that they lie very close to the straight line 13.51*n, so even if we cannot prove it, we believe we now know how this sequence grows (see the plots in the links below). - _N. J. A. Sloane_, Sep 27 2006

%C After a few initial terms, the sequence settles into a regular pattern of dense clumps separated by sparse gaps, with period 21.601584+. This pattern continues up to at least a(n) = 5*10^6. (This comment is just a qualitative statement about the wavelike distribution of Ulam numbers, not meant to imply that every period includes Ulam numbers.) - _David W. Wilson_

%C _Don Knuth_ (Sep 26 2006) remarks that a(4952)=64420 and a(4953)=64682 (a gap of more than ten "dense clumps"); and there is a gap of 315 between a(18857) and a(18858).

%C 1,2,3,47 are the only values of x < 6.759*10^8 such that x and x+1 are both Ulam numbers. - _Jud McCranie_, Jun 08 2001. This holds through the first 28 billion Ulam numbers - _Jud McCranie_, Jan 07 2016.

%C From _Jud McCranie_ on _David W. Wilson_'s illustration, Jun 20 2008: (Start)

%C The integers are shown from left to right, top to bottom, with a dot where there is an Ulam number. I think his plot is 216 wide. The local density of Ulam numbers goes in waves with a period of 21.6+, so his plot shows ten cycles.

%C When they are arranged that way you can see the waves. The crests of the density waves don't always have Ulam numbers there but the troughs are practically void of Ulam numbers. I noticed that the ratio of that period (21.6+) to the frequency of Ulam numbers (1 in 13.52) is very close to 8/5. (End)

%C a(50000000) = 675904508. - _Jud McCranie_, Feb 29 2012

%C a(100000000) = 1351856726. - _Jud McCranie_, Jul 31 2012

%C a(1000000000) = 13517664323. - _Jud McCranie_, Aug 28 2015

%C a(28000000000) = 378485625853 - Philip Gibbs & _Jud McCranie_, Sep 09 2015

%C 3 (=1+2) and 131 (=62+69) are the only two Ulam numbers in the first 28 billion Ulam numbers that are the sum of two consecutive Ulam numbers. - _Jud McCranie_, Jan 09 2016

%C Named after the Polish-American scientist Stanislaw Ulam (1909-1984). - _Amiram Eldar_, Jun 08 2021

%D Steven R. Finch, Mathematical Constants, Cambridge, 2003, Section 2.16.2.

%D Richard K. Guy, Unsolved Problems in Number Theory, C4.

%D Donald E. Knuth, The Art of Computer Programming, Volume 4A, Section 7.1.3.

%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%D 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.

%D 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.

%H Jud McCranie, <a href="/A002858/b002858.txt">Table of n, a(n) for n = 1..10000</a>

%H Richard A. Becker, <a href="/A002858/a002858.ps">Plot of residuals a(n) - 13.5167*n for n <= 3000000</a>, postscript file [uses Jud McCranie's values of a(n)].

%H Richard A. Becker, <a href="/A002858/a002858_1.pdf">Plot of residuals a(n) - 13.5167*n for n <= 3000000</a>, pdf file [uses Jud McCranie's values of a(n)].

%H Thomas Bloom, <a href="https://www.erdosproblems.com/342">Problem 342</a>, Erdős Problems.

%H Henning Fernau and Kshitij Gajjar, <a href="https://arxiv.org/abs/2107.12973">The Space Complexity of Sum Labelling</a>, arXiv:2107.12973 [cs.DS], 2021.

%H Steven R. Finch, <a href="/FinchSadd.html">Ulam s-Additive Sequences</a>. [From Steven Finch, Apr 20 2019]

%H Steven R. Finch, <a href="http://www.people.fas.harvard.edu/~sfinch/constant/stlrsky/stlrsky.html">Stolarsky-Harborth Constant</a>.

%H Steven R. Finch, <a href="http://web.archive.org/web/20010207195349/http://www.mathsoft.com/asolve/constant/stlrsky/stlrsky.html">Stolarsky-Harborth Constant</a>. [From the Wayback machine]

%H Philip Gibbs, <a href="http://vixra.org/abs/1508.0085">An Efficient Way to Compute Ulam Numbers</a>.

%H Philip Gibbs, <a href="http://vixra.org/abs/1508.0045">A Conjecture for Ulam Sequences</a>.

%H Philip Gibbs and Judson McCranie, <a href="https://www.researchgate.net/profile/Philip_Gibbs/publication/320980165_The_Ulam_Numbers_up_to_One_Trillion/links/5a058786aca2726b4c78588d/The-Ulam-Numbers-up-to-One-Trillion.pdf">The Ulam Numbers up to One Trillion</a>, (2017).

%H Alois P. Heinz, <a href="/A002858/a002858_1.png">Ulam spiral of Ulam numbers</a>.

%H Donald E. Knuth, <a href="http://www-cs-faculty.stanford.edu/~knuth/programs.html">Downloadable programs</a>

%H Noah Kravitz and Stefan Steinerberger, <a href="https://arxiv.org/abs/1705.01883">Ulam Sequences and Ulam Sets</a>, arXiv:1705.01883 [math.CO], 2017.

%H Borys Kuca, <a href="https://arxiv.org/abs/1804.09594">Structures in Additive Sequences</a>, arXiv:1804.09594 [math.NT], 2018. See p. 3.

%H J. W. Moon, R. K. Guy, and N. J. A. Sloane, <a href="/A003046/a003046.pdf">Correspondence, 1973</a>.

%H Ed Pegg, Jr., <a href="http://www.wolframscience.com/preview/nks_pages/?NKS0908.gif">Graph of 10^6 terms of a(n) - 13.5*n</a>.

%H Popular Computing (Calabasas, CA), <a href="/A003309/a003309.pdf">Sieves: Problem 43</a>, Vol. 2 (No. 13, Apr 1974), pp. 6-7. This is Sieve #8. [Annotated and scanned copy]

%H R. Queneau, <a href="https://doi.org/10.1016/0097-3165(72)90083-0">Sur les suites s-additives</a>, J. Combin. Theory, A12 (1972), 31-71.

%H Bernardo Recamán, <a href="http://www.jstor.org/stable/2319404">Questions on a sequence of Ulam</a>, Amer. Math. Monthly, Vol. 80, No. 8 (1973), pp. 919-920.

%H Ivano Salvo and Agnese Pacifico, <a href="https://arxiv.org/abs/1807.11792">Computing Integer Sequences: Filtering vs Generation (Functional Pearl)</a>, arXiv:1807.11792 [cs.PL], 2018.

%H James Schmerl and Eugene Spiegel, <a href="https://doi.org/10.1016/0097-3165(94)90058-2">The regularity of some 1-additive sequences</a>, J. Combin. Theory. Ser. A, Vol. 66, No. 1 (1994), pp. 172-175. Math. Rev. 95h:11010.

%H Arseniy Sheydvasser, <a href="https://arxiv.org/abs/1910.00109">The Ulam Sequence of the Integer Polynomial Ring</a>, arXiv:1910.00109 [math.NT], 2019.

%H N. J. A. Sloane, <a href="/A001149/a001149.pdf">Handwritten notes on Self-Generating Sequences, 1970</a> (note that A1148 has now become A005282).

%H Arseniy (Senia) Sheydvasser, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL24/Sheydvasser/sheyd3.html">The Ulam Sequence of Linear Integer Polynomials</a>, J. Int. Seq., Vol. 24 (2021), Article 21.10.8.

%H Stefan Steinerberger, <a href="http://cpsc.yale.edu/sites/default/files/files/tr1508.pdf">A hidden signal in the Ulam sequence</a>, Research Report YALEU/DCS/TR-1508, Yale University, 2015.

%H Stefan Steinerberger, <a href="/A002858/a002858_2.png">A hidden signal in the Ulam sequence</a>, Figure 2 from Research Report YALEU/DCS/TR-1508, Yale University, 2015.

%H Stefan Steinerberger, <a href="https://gilkalai.wordpress.com/2016/04/12/stefan-steinerberger-the-ulam-sequence/">The Ulam Sequence</a>, blog post, April 12, 2016.

%H Stanislaw M. Ulam, <a href="/A002858/a002858.pdf">On some mathematical problems connected with patterns of growth of figures</a>, 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]

%H Stanislaw Ulam, <a href="https://doi.org/10.1137/1006090">Combinatorial analysis in infinite sets and some physical theories</a>, SIAM Rev., Vol. 6, No. 4 (1964), pp. 343-355. Reprinted in Selected Papers, MIT Press, see p. 393.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/UlamSequence.html">Ulam Sequence</a>.

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Ulam_number">Ulam number</a>.

%H David W. Wilson, <a href="/A002858/a002858.png">Plot of initial terms</a>, 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.

%H Robert G. Wilson v, <a href="/A002858/a002858_3.pdf">Letter to N. J. A. Sloane, Sep. 1992</a>.

%H David Zeitlin, <a href="/A002858/a002858_2.pdf">Ulam's sequence {U_n}, U_1=1, U_2=2, is a complete sequence</a>, Notices Amer. Math. Soc., 22 (No. 7, 1975), Abstract 75T-A267, p. A-707. (Annotated scanned copy)

%H <a href="/index/U#Ulam_num">Index entries for Ulam numbers</a>

%p 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:

%p UlamList(59); # _Peter Luschny_, Apr 05 2019

%t 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]

%t (* Second program: *)

%t 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 *)

%t 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 *)

%o (Haskell)

%o a002858 n = a002858_list !! (n-1)

%o a002858_list = 1 : 2 : ulam 2 2 a002858_list

%o ulam :: Int -> Integer -> [Integer] -> [Integer]

%o ulam n u us = u' : ulam (n + 1) u' us where

%o u' = f 0 (u+1) us'

%o f 2 z _ = f 0 (z + 1) us'

%o f e z (v:vs) | z - v <= v = if e == 1 then z else f 0 (z + 1) us'

%o | z - v `elem` us' = f (e + 1) z vs

%o | otherwise = f e z vs

%o us' = take n us

%o -- _Reinhard Zumkeller_, Nov 03 2011

%o (Python)

%o def isUlam(n, h, u, r):

%o if h == 2: return False

%o hu = u[0]; hr = r[0]

%o if hr <= hu: return h == 1

%o if hr + hu > n: r = r[1:]

%o elif hr + hu < n: u = u[1:]

%o else: h += 1; r = r[1:]; u = u[1:]

%o return isUlam(n, h, u, r)

%o def UlamList(length):

%o u = [1, 2]; r = [2, 1]; n = 2

%o while len(u) < length:

%o n += 1

%o if isUlam(n, 0, u[:], r[:]):

%o u.append(n); r.insert(0, n)

%o return u

%o print(UlamList(59)) # _Peter Luschny_, Apr 06 2019

%o (Julia)

%o function isUlam(u, n, h, i, r)

%o h == 2 && return false

%o ur = u[r]; ui = u[i]

%o ur <= ui && return h == 1

%o if ur + ui > n

%o r -= 1

%o elseif ur + ui < n

%o i += 1

%o else

%o h += 1; i += 1; r -= 1

%o end

%o isUlam(u, n, h, i, r)

%o end

%o function UlamList(len)

%o u = Array{Int, 1}(undef, len)

%o u[1] = 1; u[2] = 2; i = 2; n = 2

%o while i < len

%o n += 1

%o if isUlam(u, n, 0, 1, i)

%o i += 1

%o u[i] = n

%o end

%o end

%o return u

%o end

%o println(UlamList(59)) # _Peter Luschny_, Apr 07 2019

%o (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

%Y Cf. A002859 (version beginning 1,3), A054540, A003667, A001857, A007300, A117140, A214603.

%Y First differences: A072832, A072540.

%Y Cf. A080287, A080288, A004280 (if distinct removed from definition).

%Y Cf. A199016, A199017, A033629, A274522.

%Y See also the density plots in A080573 and A285884.

%K nonn,nice

%O 1,2

%A _N. J. A. Sloane_

%E More terms from _Jud McCranie_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 8 10:33 EDT 2024. Contains 372332 sequences. (Running on oeis4.)