Ulam Number Calculator

Sequence

Is 16 an Ulam number?Yes - it is Ulam number #9, the unique sum 3 + 13
Representations as a sum of two distinct earlier Ulam numbers1
Position in the sequence#9
Next Ulam number after 1618
How this was calculated
  1. An Ulam number (after the first two, 1 and 2) is the smallest integer larger than the previous term that can be written as a sum of two distinct earlier Ulam numbers in exactly one way.
  2. Building the sequence up to 16 by that unique-sum rule, 16 itself turns out to have 1 qualifying representation.
  3. Its only representation is 3 + 13, so it enters the sequence at position 9.
  4. Ulam numbers have an observed density of about 0.074, though Ulam conjectured it might be zero; either way, membership is decided purely by the one-representation rule.

The Ulam Number Calculator finds Ulam numbers for you and shows how each one is built. The sequence starts 1, 2, 3, 4, 6, 8, 11, 13, 16, 18, 26, 28, 36. After the seeds 1 and 2, each Ulam number is the smallest integer greater than the previous one that can be written as a sum of two distinct earlier Ulam numbers in exactly one way. The calculator applies that rule and returns the sequence in order, so you can see which numbers qualify and which do not. For example, 16 is the 9th Ulam number because its only representation is 3 + 13. Next comes 18, the 10th Ulam number, whose only representation is 2 + 16. By contrast, 23 is not an Ulam number: it has no representation as a sum of two distinct earlier Ulam numbers.

The method behind the calculator is the accepted standard for this kind of calculation because it follows the definition directly: test each integer in turn, count its representations as a sum of two distinct earlier Ulam numbers, and keep only those with exactly one. Nothing is assumed or estimated. Stanislaw Ulam introduced the sequence in 1964, and its observed density is about 0.074. This page shows the formula, step-by-step workings, worked examples and sources, so you can check every result rather than take it on trust.

Worked examples

16, the ninth Ulam number

(16)

Is 16 an Ulam number?Yes - it is Ulam number #9, the unique sum 3 + 13
Representations as a sum of two distinct earlier Ulam numbers1
Position in the sequence#9
Next Ulam number after 1618

18, the tenth Ulam number

(18)

Is 18 an Ulam number?Yes - it is Ulam number #10, the unique sum 2 + 16
Representations as a sum of two distinct earlier Ulam numbers1
Position in the sequence#10
Next Ulam number after 1826

23, which has no representation

(23)

Is 23 an Ulam number?No - it has 0 representations as a sum of two distinct earlier Ulam numbers, not exactly one
Representations as a sum of two distinct earlier Ulam numbers0
Position in the sequenceNot a member
Next Ulam number after 2326

What is an Ulam number?

An Ulam number belongs to a sequence built by a greedy rule about sums. The sequence starts with the seeds 1 and 2. From there, the rule is simple to state: after the seeds 1 and 2, each Ulam number is the smallest integer greater than the previous one that can be written as a sum of two distinct earlier Ulam numbers in exactly one way. The phrase "exactly one way" is the heart of the definition. An integer that can be formed from two distinct earlier terms in two or more different ways is skipped, and so is an integer that cannot be formed at all.

Applying that rule produces the opening run of the sequence: 1, 2, 3, 4, 6, 8, 11, 13, 16, 18, 26, 28, 36. The first few steps show how the greedy condition works. The seeds are 1 and 2. The next term is 3, since 3 = 1 + 2 and that is its only representation using two distinct earlier Ulam numbers. Then 4 = 1 + 3, again uniquely. The number 5 is not in the sequence because it can be written as 1 + 4 and as 2 + 3, which is two representations rather than one. That is why the run jumps from 4 to 6.

Later terms follow the same pattern, and the uniqueness test can be checked against the list. The number 16 is the 9th Ulam number, and its only representation is 3 + 13. The number 18 is the 10th Ulam number, and its only representation is 2 + 16. The sequence also shows clear gaps. The number 23 is not an Ulam number: it has no representation as a sum of two distinct earlier Ulam numbers. Each accepted term must pass the same test, so the sequence is determined entirely by the terms that came before it.

Stanislaw Ulam introduced the sequence in 1964. Despite the straightforward definition, the sequence is not fully understood, and its observed density is about 0.074. That figure describes how often Ulam numbers appear among the integers in the range where they have been studied, not a proven formula for predicting the next term. Because each new term depends on counting representations among all earlier terms, the sequence is easy to generate step by step but hard to describe in a closed form. That contrast between a simple rule and unpredictable-looking output is a large part of why the Ulam number sequence remains interesting to mathematicians and to anyone exploring number patterns.

The rule in one line: after the seeds 1 and 2, each Ulam number is the smallest integer greater than the previous one that can be written as a sum of two distinct earlier Ulam numbers in exactly one way.

How membership is tested

To test whether a particular integer belongs to the sequence, you do not need a special formula. You rebuild the sequence from its seeds up to that candidate and watch how the representations behave. The seeds are 1 and 2. After them, each Ulam number is the smallest integer greater than the previous one that can be written as a sum of two distinct earlier Ulam numbers in exactly one way. So the test is really a counting test: for every integer in turn, list all the ways it can be formed by adding two different terms already accepted, and accept the integer only if that list has exactly one entry.

The count matters in both directions. Zero representations means the integer is skipped, and more than one representation also means it is skipped. This is why the sequence is not simply the list of numbers with some additive property; uniqueness is the whole rule. Working upward, the early terms come out as 1, 2, 3, 4, 6, 8, 11, 13, 16, 18, 26, 28, 36. Each of those was accepted because, at the moment it was considered, exactly one pair of distinct earlier Ulam numbers summed to it.

Take 16 as a worked acceptance. By the time the test reaches 16, the earlier Ulam numbers include 1, 2, 3, 4, 6, 8, 11 and 13. Checking sums of two distinct terms from that list, the only pair that produces 16 is 3 + 13. No other pair works, so the representation count is exactly one, and 16 is accepted as the 9th Ulam number. The same procedure gives 18 as the 10th term, since its only representation is 2 + 16.

Now take 23 as a worked rejection. Using the earlier Ulam numbers, there is no pair of distinct terms that adds to 23. The representation count is zero, so 23 is not an Ulam number. Notice that the test does not ask whether 23 is interesting or whether it is close to a sum; it asks only for the number of distinct valid pairs, and zero fails the rule just as surely as two would.

This is the sense in which an Ulam number is defined by its history rather than by a closed expression: membership depends on the terms accepted before it. Because every candidate is checked against the growing list of earlier terms, the work grows as the sequence lengthens, but the logic stays the same at every step. Stanislaw Ulam introduced the sequence in 1964, and its observed density is about 0.074.

The test is a count, not a search for any single sum: exactly one representation of two distinct earlier terms means accept; zero or two or more means reject.

The first Ulam numbers

The Ulam number sequence begins 1, 2, 3, 4, 6, 8, 11, 13, 16, 18, 26, 28, 36. The first two terms, 1 and 2, are seeds. After the seeds, each Ulam number is the smallest integer greater than the previous one that can be written as a sum of two distinct earlier Ulam numbers in exactly one way. That single rule — one representation, no more and no fewer — is what makes the sequence behave so differently from the familiar counting numbers.

The table below lists the first 16 Ulam numbers with their positions. Where the unique representation is short, it is shown alongside the term. Note that 3 is 1 + 2, 4 is 1 + 3, and 6 is 2 + 4. Further along, 16 is the 9th Ulam number: its only representation is 3 + 13. And 18 is the 10th Ulam number: its only representation is 2 + 16.

The gaps in the list are as telling as the entries. The number 5 never appears, because it can be formed as 1 + 4 and as 2 + 3 — two representations, so it fails the exactly-one-way test. The number 23 is not an Ulam number either: it has no representation as a sum of two distinct earlier Ulam numbers. Checking candidates this way, one at a time, is exactly how the sequence is built, and it is why the list thins out as it grows.

Stanislaw Ulam introduced the sequence in 1964. Its observed density is about 0.074, meaning Ulam numbers become sparser as you move up the number line. Even so, the rule that generates them stays simple to state and simple to apply, which is part of the sequence's appeal.

You can reproduce the early terms by hand. Start with 1 and 2. The smallest integer greater than 2 that is a sum of two distinct earlier terms in exactly one way is 3 (1 + 2). Next comes 4 (1 + 3), then 6 (2 + 4), then 8, 11, 13, 16, 18, and onward through 26, 28, and 36. Each new term depends only on the terms before it, so the list can be extended step by step without any other input.

PositionUlam numberUnique representation
11seed
22seed
331 + 2
441 + 3
562 + 4
68
711
813
9163 + 13
10182 + 16
1126
1228
1336
23 is not an Ulam number: it has no representation as a sum of two distinct earlier Ulam numbers.

What is known and unknown

The Ulam sequence begins 1, 2, 3, 4, 6, 8, 11, 13, 16, 18, 26, 28, 36. After the seeds 1 and 2, each Ulam number is the smallest integer greater than the previous one that can be written as a sum of two distinct earlier Ulam numbers in exactly one way. Stanislaw Ulam introduced the sequence in 1964, and in the decades since, mathematicians have learned a great deal about how it behaves — while some of the most basic questions about it remain open.

One of the most striking known facts is density. Counting how many Ulam numbers appear up to a given limit, the observed density is about 0.074. In other words, roughly 7 to 8 out of every 100 integers turn out to be Ulam numbers, at least over the ranges that have been examined. This is a measured pattern rather than a proven law, and it is one of the features that makes the sequence so intriguing: a rule that looks simple and local produces a global distribution that appears remarkably stable.

What is not known is whether that density persists forever. Ulam himself conjectured that the density of the sequence is zero — that is, that Ulam numbers become vanishingly rare as you look further and further out, even though the observed density near the start of the sequence sits at about 0.074. Whether Ulam's zero-density conjecture is true remains an open problem. This is a rare situation in which a sequence anyone can generate by hand has a basic structural question attached to it that no one has settled.

A second area of progress is computation. Because the definition is straightforward, the sequence can be generated quickly by machine, and fast computation records have pushed the known terms of the Ulam number sequence to very large ranges. These computations are what supply the density estimate of about 0.074 and what allow researchers to test conjectures numerically before attempting proofs. Even so, large-scale computation does not by itself resolve the zero-density question; it can only show how the sequence behaves within the range actually calculated.

A third curiosity is the near-periodicity of the differences between consecutive Ulam numbers. The gaps between successive terms are not periodic in any strict sense, yet they display a recurring, almost rhythmic pattern that has attracted attention and resisted simple explanation. The early terms illustrate how the rule works in practice: 16 is the 9th Ulam number, with only the representation 3 + 13, and 18 is the 10th, with only the representation 2 + 16. By contrast, 23 is not an Ulam number, because it has no representation as a sum of two distinct earlier Ulam numbers. Simple local checks like these build the sequence term by term; why the resulting gaps should look nearly periodic, and why the overall density should be about 0.074, are questions that remain only partly answered.

Known: the observed density is about 0.074. Unknown: whether Ulam's zero-density conjecture is true.

FAQs

What is an Ulam number?

An Ulam number is generated greedily: after 1 and 2, each term is the smallest larger integer expressible as a sum of two distinct earlier Ulam numbers in exactly one way. That single-representation rule is what makes the sequence unusual, since most integers fail it and are skipped entirely.

Is 16 an Ulam number?

Yes. 16 is the 9th Ulam number, with the unique representation 3 + 13. Because 16 can be written as a sum of two distinct earlier Ulam numbers in exactly one way, it qualifies under the greedy rule and joins the sequence in that ninth position.

Is 23 an Ulam number?

No. 23 has no representation as a sum of two distinct earlier Ulam numbers, so it is skipped. The definition demands exactly one such representation, and 23 offers none at all, which means it never enters the sequence no matter how far the terms are extended.

What is the next Ulam number after 18?

26. After 18, the sequence continues to 26, the next integer that is the smallest larger value expressible as a sum of two distinct earlier Ulam numbers in exactly one way. Any integer falling between those two terms fails the unique-representation test and is skipped.

Who invented Ulam numbers?

Stanislaw Ulam introduced them in 1964; the sequence is catalogued in the OEIS. The idea grew out of his broader work on sequences defined by simple rules, and the OEIS entry lets anyone look up terms and check the greedy construction against published values.

Why must the two summands be distinct?

The definition requires two different earlier Ulam numbers; allowing a term to double itself would generate a different sequence. Keeping the summands distinct is part of the rule itself, so changing it produces different terms and a sequence that no longer matches the standard one.

Sources

Related calculators

Aliquot Sequence Calculator
Trace an aliquot sequence to its fate: termination at 0, a perfect fixed point, or an amicable or sociable cycle.
Padovan Number Calculator
Terms of the Padovan sequence, P(k) = P(k - 2) + P(k - 3), with the next term, the ratio approaching the plastic number, and the running sum.
Abundant Number Calculator
Classify any whole number as abundant, perfect or deficient from its aliquot sum: the sum of its proper divisors, the abundance or deficiency against the number itself, and the s(n)/n ratio that puts perfect numbers exactly at one.