Somos-4 Sequence Calculator
Number Theory
- The Somos-4 sequence starts a(1) = a(2) = a(3) = a(4) = 1 and then follows the recurrence a(n) = (a(n-1) x a(n-3) + a(n-2)^2) / a(n-4).
- The first computed terms are a(5) = 2, a(6) = 3 and a(7) = 7, after which the sequence grows quickly: 23, 59, 314, 1,529, ...
- The final step gives a(11) = (314 x 23 + 59^2) / 7 = 1,529.
- Somos sequences are the classic example of the Laurent phenomenon: although the recurrence divides at every step, every term comes out an exact integer.
Some recurrences are famous because they grow fast. The Somos-4 sequence is famous because it should not work at all. Start with four 1s, and define each new term from the previous four by a formula that divides: a(n) = (a(n-1) x a(n-3) + a(n-2) squared) / a(n-4). There is no earthly reason the division should come out exact - yet it does, every single time, producing the integers 1, 1, 1, 1, 2, 3, 7, 23, 59, 314, 1,529 and onward.
This calculator generates the sequence out to the 17th term using exact integer arithmetic. Michael Somos discovered the phenomenon while investigating elliptic curves and theta functions; mathematicians later explained it through the Laurent phenomenon and cluster algebras, two frameworks built partly to understand surprises like this one.
Try the 13th term: 83,313. Getting there required twelve divisions, every one of which cancelled perfectly.
Worked examples
Eleventh term
(11)
| Somos-4 term a(n) | 1,529 |
| Previous term | 314 |
| Growth ratio to previous term | 4.87 |
| Terms generated | 11 |
Eighth term
(8)
| Somos-4 term a(n) | 23 |
| Previous term | 7 |
| Growth ratio to previous term | 3.29 |
| Terms generated | 8 |
Thirteenth term
(13)
| Somos-4 term a(n) | 83,313 |
| Previous term | 8,209 |
| Growth ratio to previous term | 10.15 |
| Terms generated | 13 |
The recurrence step by step
The seeds are a(1) = a(2) = a(3) = a(4) = 1. The first computed term is a(5) = (a(4) x a(2) + a(3) squared) / a(1) = (1 + 1) / 1 = 2. Then a(6) = (2 x 1 + 1) / 1 = 3, and a(7) = (3 x 1 + 4) / 1 = 7. Still tame - every denominator so far is 1.
The miracle starts at a(8) = (7 x 2 + 9) / 1 = 23 and continues: a(9) = (23 x 3 + 49) / 2 = 118 / 2 = 59. That division by 2 is the first real test, and it passes. From there the denominators grow with the sequence itself, and every quotient still lands on an integer.
Why the integers survive
The explanation is the Laurent phenomenon, identified by Fomin and Zelevinsky in their work on cluster algebras. Certain recurrences, though they involve division, always produce Laurent polynomials in the seeds - expressions with only positive powers in the numerator. When the seeds are all 1, every term is forced to be a sum of whole-number contributions, hence an integer.
Somos found his sequences before that theory existed, by noticing the integrality empirically in sequences arising from elliptic curves. The -4, -5, -6 and -7 versions share the property; Somos-8 was the first to break it, producing fractions - a boundary the theory now explains.
How fast it grows
After the gentle start, growth becomes violent: 314 at the 10th term, 83,313 at the 13th, 620,297 at the 14th and 7,869,898 at the 15th. The number of digits roughly doubles every three steps, driven by the squared term in the numerator.
That growth is exactly why this calculator stops at the 17th term. Beyond it, the products inside the recurrence outgrow the exact integer range of ordinary double-precision arithmetic, and a responsible calculator refuses to print digits it cannot guarantee. With arbitrary-precision arithmetic the sequence continues indefinitely - every term still an integer.
A worked final step
The last-step display for the 13th term shows the machinery plainly: a(13) = (a(12) x a(10) + a(11) squared) / a(9) = (8,209 x 314 + 1,529 squared) / 59. The numerator is 2,577,626 + 2,337,841 = 4,915,467, and 4,915,467 / 59 = 83,313 exactly.
Pause on that division: a five-digit denominator dividing a seven-digit numerator with no remainder, at the end of a chain of similar accidents. Multiplied across every term, the Somos phenomenon is one of the most quotable miracles in elementary mathematics.
Somos and elliptic curves
The sequence was not invented as a curiosity. Somos encountered quadratic recurrences of this shape while studying the arithmetic of elliptic curves, where related sequences (elliptic divisibility sequences) encode points on the curve. The integrality there reflects group structure; the Laurent phenomenon later supplied the elementary explanation.
That dual citizenship - part number-theoretic toy, part shadow of deep geometry - is why Somos sequences keep appearing in research on cluster algebras, integrable systems and discrete dynamics.
Exploring further
Natural variations suggest themselves: change the seeds and watch integrality survive or collapse (with seeds other than 1 the terms become rational, but the Laurent property still constrains them), or move to Somos-5, whose recurrence reaches back five terms.
The sequence itself is A006720 in the OEIS, where values far beyond this calculator's range are tabulated - all integers, as the phenomenon promises.
Changing the seeds
Feed the recurrence different starting values and the magic changes character. With seeds of 1, 2, 3, 4 the terms become fractions quickly, yet they remain Laurent polynomials in the seeds - plug the seeds back as symbols and every denominator is a monomial, never a polynomial that could produce true fractions at generic values.
That distinction - integrality at the all-ones point versus the Laurent property everywhere - is exactly what cluster algebra theory clarified. The all-ones miracle that Somos noticed is the visible tip of a structural property holding for all seeds at once.
Somos-5 and the family
Somos-5 uses the recurrence a(n) = (a(n-1) a(n-4) + a(n-2) a(n-3)) / a(n-5) and also stays integral, as do Somos-6 and Somos-7 with their longer reaches. Each was found the same way - by computing and noticing - and each later fell under the same Laurent explanation.
Somos-8 is the boundary case that fails, and its failure is as instructive as the others' success: the cluster-algebra structure that powers the phenomenon provably extends only so far, and the sequence detects the edge before the theory did.
Computing further
With arbitrary-precision arithmetic the sequence has been pushed thousands of terms; the values swell to thousands of digits while remaining integers to the last unit. The growth constant - the factor by which terms multiply per step - is governed by the arithmetic of the elliptic curve hiding behind the recurrence, tying this elementary-looking process to the theory of elliptic divisibility sequences.
For casual exploration the 17 exact terms this calculator guarantees are plenty: the pattern, the growth and the miracle are all fully visible by the 13th term.
A five-minute experiment
The integrality is best believed after a hand computation. Take the terms up to a(9) = 59 from this page and compute a(10) yourself: (59 x 7 + 23 squared) / 3 = (413 + 529) / 3 = 942 / 3 = 314. A denominator of 3, cancelling against a numerator built from unrelated-looking terms - one more small accident in an infinite series of them.
Then notice that the accident was guaranteed: nothing about 413 + 529 had to be divisible by 3, yet the structure of the recurrence forced it. That tension between local accident and global guarantee is the whole subject.
Why the calculator caps the index
Double-precision arithmetic represents integers exactly only up to 2^53, about nine quadrillion. Inside the recurrence, products of terms appear; by the 18th term those products cross the exactness boundary, and a printed digit could silently be wrong. The cap at 17 keeps every intermediate product exact, so every digit shown is a digit proved.
Arbitrary-precision tools remove the cap, and the OEIS carries the sequence far beyond it - the cap is a property of this page's arithmetic, not of the sequence.
Somos in the classroom
Few sequences teach as much per line of definition: recursion, divisibility, the difference between pattern and proof, and the existence of phenomena (Laurent's) that organize miracles into theory. A student who computes eight terms, conjectures integrality, and then learns it is a theorem with a name has had a genuine mathematical experience.
The sequence also disciplines intuition about growth: terms that begin 1, 1, 1, 1, 2, 3 are, fifteen steps later, in the millions - a standing warning against extrapolating from first terms.
Somos and cluster algebras
The Laurent phenomenon that Somos-4 dramatizes was later found at the heart of cluster algebras, a structure invented by Fomin and Zelevinsky for entirely different reasons in Lie theory. Cluster mutations divide by earlier variables exactly as the recurrence does, and the Laurent property there is a theorem of the same family.
That an olympiad-flavoured puzzle sequence turned out to be a window into a major modern theory is a familiar pattern in mathematics: the toy was a shadow of the cathedral. Somos sequences now appear in textbooks as the friendliest door into the subject.
FAQs
What is the Somos-4 sequence?
A sequence starting 1, 1, 1, 1 in which each term is (a(n-1) x a(n-3) + a(n-2) squared) / a(n-4) - and every term is an integer.
What are the first Somos-4 numbers?
1, 1, 1, 1, 2, 3, 7, 23, 59, 314, 1,529, 8,209, 83,313.
Why is Somos-4 surprising?
The recurrence divides at every step, yet no fraction ever appears - an instance of the Laurent phenomenon from cluster algebra theory.
What is the 11th Somos-4 number?
1,529.
What is the 15th Somos-4 number?
7,869,898.
Do all Somos sequences stay integral?
Somos-4, 5, 6 and 7 do. Somos-8 and beyond produce fractions.
Why does this calculator stop at the 17th term?
Beyond it, the products inside the recurrence exceed the exact integer range of double-precision arithmetic, so later digits could not be guaranteed.
What seeds does Somos-4 start from?
Four ones: a(1) = a(2) = a(3) = a(4) = 1. The integrality miracle is stated for these seeds; other seeds give Laurent polynomials rather than plain integers.
What is the 17th Somos-4 number?
1,687,054,711 - reached through a(16) = 126,742,987 after a(15) = 7,869,898. The calculator generates terms exactly through the 17th; beyond that, double-precision products inside the recurrence would exceed the exact-integer limit.