How Mathematics Works

When a Pattern Lies, Famous Sequences That Break Their Own Rule

Meet patterns that hold for 5, 40 or hundreds of millions of cases and then fail, and learn what each one teaches about evidence.

Key takeaways

  • Agreement in many cases supports a guess but cannot establish a statement about infinitely many cases.
  • A finite list of numbers can always be continued in more than one way, so the source of the numbers matters.
  • Some false patterns survive far beyond hand calculation, because the first exception is very large.
  • A pattern deserves trust when you can explain the mechanism that produces it and see where that mechanism stops.

A pattern can be perfectly true for every case you have checked and still be false. Some break at the sixth term, some at the fortieth, and some only after hundreds of millions of successful tests. This is why mathematicians treat a pattern as a reason to look for a proof, never as the proof itself.

The examples below are all real and well established. Several can be checked with pencil and paper, and each fails for a slightly different reason.

Points on a circle

Put n points on a circle and join every pair with a straight chord. Place the points so that no three chords cross at a single interior point. Count the regions inside the circle.

points:    1   2   3   4   5    6
regions:   1   2   4   8   16   31

After 1, 2, 4, 8 and 16, nearly everyone predicts 32. The answer is 31. The correct formula counts one starting region, plus one more for each chord, plus one more for each interior crossing. There is a chord for each pair of points and a crossing for each set of four points:

regions = 1 + C(n, 2) + C(n, 4)

n = 5:   1 + 10 + 5  = 16
n = 6:   1 + 15 + 15 = 31
n = 7:   1 + 21 + 35 = 57

Here C(n, k) is the number of ways to choose k things from n, taken to be 0 when k exceeds n. The early doubling is real, but it happens because this formula adds up the first few entries of a row of Pascal's triangle, and for small n those entries make up the whole row. At n = 6 they no longer do.

A formula that makes primes, for a while

Leonhard Euler noticed that the expression n² + n + 41 produces primes with remarkable persistence. For n = 0, 1, 2, 3 it gives 41, 43, 47, 53. In fact every value from n = 0 through n = 39 is prime.

n = 39:   1521 + 39 + 41 = 1601         prime
n = 40:   1600 + 40 + 41 = 1681 = 41²   not prime
n = 41:   41 × (41 + 1 + 1) = 41 × 43   not prime

Forty successes in a row, and then failure. With hindsight the failure at n = 41 was guaranteed, since every term is then divisible by 41. In fact no non-constant polynomial with integer coefficients can give primes for every whole number input. The reason for the long streak is deeper and belongs to algebraic number theory.

Sevens in a row

Look at the numbers 31, 331, 3331, 33331, 333331, 3333331 and 33333331. All seven are prime. The eighth is not:

333333331 = 17 × 19607843

Nothing about the shape of the digits forces primality. Large primes are fairly common among numbers of this size, so a short run of luck is no great surprise. The mathematician Richard Guy gave this kind of trap a name, the strong law of small numbers: small numbers have to serve in so many patterns that many coincidences among them are unavoidable.

Fermat's guess

Pierre de Fermat considered numbers of the form 2 raised to the power 2ⁿ, plus 1. The first five are 3, 5, 17, 257 and 65,537, all prime. He believed the pattern continued.

In 1732 Euler showed that the next one fails:

2^32 + 1 = 4,294,967,297 = 641 × 6,700,417

No further prime of this form has been found as of the mid-2020s, and many larger ones are known to be composite. So a guess that "all are prime" may be about as wrong as a guess can be. Yet the five early primes matter greatly, for reasons explained in Fermat primes and constructible polygons.

A prime test that is almost right

If p is a prime, then p divides 2ᵖ − 2. This is a case of Fermat's little theorem, and it is true without exception. For p = 7, 2⁷ − 2 = 126 = 7 × 18.

Try composite numbers and the divisibility keeps failing: 4 does not divide 14, 6 does not divide 62 and 9 does not divide 510. It is natural to suspect the converse, that n divides 2ⁿ − 2 only when n is prime. The first composite exception is 341 = 11 × 31.

2^10 = 1024 = 3 × 341 + 1          so 2^10 leaves remainder 1
2^340 = (2^10)^34                  leaves remainder 1^34 = 1
2^341 = 2 × 2^340                  leaves remainder 2
therefore 341 divides 2^341 − 2, although 341 is not prime

A true theorem had been quietly turned around into a false one. Exceptions of this kind are rare compared with the primes, which is why refined versions of the test are useful in practice, including the Miller-Rabin test.

Coefficients that stay small

Factor the polynomial xⁿ − 1 as far as possible using integer coefficients. For example, x⁴ − 1 = (x − 1)(x + 1)(x² + 1). As you try larger n, every coefficient in every factor seems to be −1, 0 or 1.

The pattern holds for every n up to 104. At n = 105 one factor contains a coefficient of −2. The number 105 equals 3 × 5 × 7, the smallest product of three different odd primes, and that is the first chance for the coefficients to grow. A person checking by hand would have had every reason to stop long before.

Integrals that agree until the eighth

In calculus, the area under sin(x)/x, taken from 0 to infinity in the improper-integral sense, equals π/2. Multiply the function by sin(x/3)/(x/3) and the area is still π/2. Keep multiplying by the matching factors for 5, 7, 9, 11 and 13, and each integral is again exactly π/2.

Add the factor for 15 and the result is very slightly less than π/2. These are known as the Borwein integrals, after David and Jonathan Borwein. The cause can be located precisely. The value stays at π/2 as long as 1/3 + 1/5 + ... stays below 1. Through 1/13 the sum is about 0.955. Including 1/15 pushes it to about 1.022.

The lesson is sharp: the difference is far too small to notice casually, yet it is exact and fully explained.

Failures far beyond the horizon

Some patterns about whole numbers survive enormous testing.

George Pólya raised the following question in 1919. Count each whole number up to N according to whether it has an even or odd number of prime factors, with repeats counted. For 12 = 2 × 2 × 3 the count is three, which is odd. It appeared that, for every N from 2 onward, the odd group is never smaller than the even group. C. B. Haselgrove proved in 1958 that the statement is false, and the smallest counterexample was later found to be a little over 906 million.

The Mertens conjecture, a related bound about sums built from prime factorizations, was disproved in 1985 by Andrew Odlyzko and Herman te Riele. Their proof shows that counterexamples exist without exhibiting one.

A similar story concerns the count of primes. A standard approximation called the logarithmic integral overestimates the number of primes up to x for every x that has been checked directly. In 1914 J. E. Littlewood proved that the difference nevertheless changes sign infinitely often.

Why any list can be continued any way

There is a logical reason behind all of this. Given the terms 1, 2, 4, 8, 16, you may choose any sixth term you like and still find a polynomial formula that produces the whole list. One way is to start with 2^(n−1) and add a correction that vanishes for the first five values:

term(n) = 2^(n−1) + k (n − 1)(n − 2)(n − 3)(n − 4)(n − 5)

n = 1 to 5:   the correction is 0
n = 6:        term = 32 + 120k
choose k = 1: term = 152
choose k = 0: term = 32

So "what comes next?" has no mathematically forced answer without some extra information about where the numbers come from. Puzzle questions of this type really ask for the simplest rule the author had in mind.

What the failures are good for

A broken pattern is rarely wasted effort. The question of why the circle regions leave the powers of 2 leads straight to a counting argument that explains every value. The exceptions to the prime test became a subject of study in their own right, under the name pseudoprimes. The Borwein integrals show that a clean identity can depend on a hidden inequality.

When a rule fails, ask three things. What is special about the first case that fails? Which condition would exclude it while keeping the successes? Is there a corrected statement that is true for all n? The answers often make a better theorem than the original guess.

It also helps to separate two kinds of confidence. Numerical evidence can make a conjecture worth months of work, and it guides which direction to try. A proof is a different object: it says why no exception can exist, including among numbers nobody will ever write down.

How to protect yourself

You can keep the excitement of spotting patterns while guarding against false ones.

Three patterns and where they stop
Circle regions Looks like doubling Holds for 1 to 5 points Sixth case gives 31 n² + n + 41 Looks like a prime maker Holds for n = 0 to 39 n = 40 gives 41² Borwein integrals Looks like a constant π/2 Holds through the factor for 13 The factor for 15 lowers it Circle regions Looks like doubling Holds for 1 to 5 points Sixth case gives 31 n² + n + 41 Looks like a prime maker Holds for n = 0 to 39 n = 40 gives 41² Borwein integrals Looks like a constant π/2 Holds through the factor for 13 The factor for 15 lowers it
  • Ask what mechanism could cause the pattern, and whether it can run out.
  • Test cases of a new kind, such as the first product of three primes, along with the next case in line.
  • Try inputs built to cause trouble, like n = 41 in Euler's formula.
  • State the claim as a conjecture until a proof exists.

For constructive habits, see how to use small cases and how to hunt for counterexamples. The logical gap between testing and proving is treated further in why checking a million cases is not a proof. Many famous open questions, including the Collatz conjecture, have passed huge numerical tests and remain unproved as of the mid-2020s.

Written for 4Mathematics with AI writing tools and not reviewed line by line by a person. Check anything you rely on against a textbook or primary source. Report an error.

Keep reading

All 32 articles in How Mathematics Works →

Latest news on this topic