KnowledgeInSight
What Mathematicians Do
0% of Course 1 complete

Module 1 · Lesson 2

Number Theory: Codes, cryptography, and the Riemann Hypothesis

You'll see how the arithmetic of primes and remainders now protects online payments and catches typing errors in book numbers. You'll also meet the questions about primes that remain unanswered, including one with a million-dollar prize.

What you will be able to do

  • Explain how number theory secures digital communication and why questions about primes remain open.

0% of this lesson · 10 items · 1h 33m total · 1h 18m without the optional activity

Contents of this lesson10 items
  1. ReadingThe Lock Icon in Your Browser and the Primes Behind It3 min
  2. ReadingPublic-Key Encryption: How RSA Uses Primes and Remainders4 min
  3. ReadingCheck Digits: Modular Arithmetic That Catches Typing Errors4 min
  4. ReadingHow Primes Are Spread Out: The Prime Number Theorem4 min
  5. ReadingOpen Questions About Primes: Riemann, Twin Primes, and Goldbach4 min
  6. Guided ReadingGuided Walkthrough: How a Check Digit Catches a Typing Error in an ISBN7 min
  7. Guided ConversationWeigh What Number Theory Guarantees12 min
  8. Hands-on Activity · optionalEncrypt and Decrypt a Message with Toy RSA15 min
  9. Knowledge CheckCodes, cryptography, and the Riemann Hypothesis10 min
  10. Graded QuizNumber Theory30 min

Report an issue on this page

Reading 3 min Done

The Lock Icon in Your Browser and the Primes Behind It

When you pay for something online, your browser usually shows a small lock, or a similar icon, beside the web address. It signals an encrypted connection: what you type travels to the site scrambled, so anyone listening in sees nonsense.

That raises a puzzle worth trying. You and the shop have never met. Every message between you crosses a public network, where anyone could copy it. How can the two of you agree on a secret way to scramble messages when every word you exchange to set it up can be overheard? If you send a key, an eavesdropper copies it. If the shop sends one, the same thing happens.

For most of history the answer was that you couldn't. Two parties had to share a key in advance, in person or by a trusted messenger. In the 1970s that changed. Ronald Rivest, Adi Shamir, and Leonard Adleman, crediting the underlying idea to Diffie and Hellman, published a practical method in 1978. Each user publishes a procedure for locking messages and keeps the procedure for unlocking them private. Publishing the lock is meant not to reveal any easy way to unlock (Rivest, Shamir, and Adleman 1978, sec. II).

Their method is built from the two simplest tools in number theory, primes and remainders:

  • Turn the message into a number. To lock it, raise it to a fixed power and keep only the remainder on division by a large public number (sec. V).
  • Build that public number by multiplying two large primes, and keep the primes secret.
  • The security, in the paper's words, "rests in part on the difficulty of factoring" the public number (Rivest, Shamir, and Adleman 1978, abstract).

Multiplying two large primes is fast. Recovering the two primes from their product is, as far as anyone knows, extremely slow. The whole method lives in that gap.

That is what number theory offers here: guarantees that rest on what is easy and what is hard to compute with whole numbers. Some of those guarantees are proved. That unlocking returns the original message is a theorem, built on results of Euler and Fermat (sec. VI). Others are believed. No one has proved that factoring large numbers must be slow; it's an assumption that has survived decades of attack.

Secure web connections today use several methods, and RSA, the method named for its authors' initials, is only one of them. The idea of a public key, and the practice of resting security on problems about whole numbers that seem hard, took shape in this work. So when you see the lock, part of what you're trusting is a theorem, and part is a long-tested bet.

This content reflects the field as of October 2026.

References

  • Rivest, Ronald L., Adi Shamir, and Leonard M. Adleman. 1978. "A Method for Obtaining Digital Signatures and Public-Key Cryptosystems." Communications of the ACM 21 (2): 120–126. doi:10.1145/359340.359342.

Reading 4 min Done

Public-Key Encryption: How RSA Uses Primes and Remainders

Introduction

A lock that anyone can close but only you can open sounds impossible for a message sent over a public network. RSA builds one out of primes and remainders. This reading explains public and private keys, the RSA recipe in words, the 1978 paper's own small example, and what the method's security does and doesn't rest on. Citations give section numbers in the 1978 paper.

Two Keys Instead of One

Encryption is the process of scrambling a message so that only someone with the right information can read it. Traditional encryption uses one secret key for both locking and unlocking, so the two parties must share that key safely in advance.

Public-key encryption splits the key in two. A public key is the information anyone can use to lock a message for a particular recipient, and the recipient publishes it openly. A private key is the information only the recipient holds, and it unlocks messages locked with the matching public key. Anyone can lock; only the key holder can unlock. Rivest, Shamir, and Adleman credit this idea to Diffie and Hellman (Rivest, Shamir, and Adleman 1978, sec. I).

RSA is the public-key method that Rivest, Shamir, and Adleman published in 1978, named for their initials. Its two keys are built from a pair of primes. A prime is a whole number greater than 1 whose only positive divisors are 1 and itself.

The Recipe in Words

Here is the RSA recipe, stated without the formulas (sec. V and VII):

  1. Choose two large primes. Call them p and q.
  2. Multiply them to get a number n = p \times q.
  3. Using p and q, choose a suitable unlocking exponent, called d.
  4. From d, p, and q, work out the matching locking exponent, called e.
  5. Publish n and e as the public key. Keep d, and the primes p and q, secret.

A message is first turned into a number smaller than n. Locking and unlocking then use the same move: raise to a power, and keep only the remainder on division by n. To encrypt, raise the message to the power e and take the remainder. To decrypt, raise the result to the power d and take the remainder. What comes out is the original message.

That last claim isn't a hope. The paper proves it, using a result of Euler's that extends Fermat's little theorem about powers and primes (sec. VI). Taking remainders is also what keeps the numbers manageable. Without it, raising a large number to a large power would produce numbers too big to store.

The Paper's Own Small Example

The 1978 paper works a deliberately tiny case (sec. VIII). It takes the primes p = 47 and q = 59, so n = 2{,}773. The locking exponent is 17 and the unlocking exponent is 157. The authors encode the sentence "ITS ALL GREEK TO ME" as numbers, two letters at a time, and lock each block by raising it to the 17th power and taking the remainder on division by 2,773.

Numbers that small offer no security. Anyone could find that 2{,}773 = 47 \times 59 in a few minutes by hand, and from there work out the unlocking exponent. The example shows the mechanics, not the protection. For real use, the paper suggests primes about 100 digits long (sec. VII).

Why It Is Believed Secure

Factoring is the task of finding the primes that multiply together to give a number. Anyone who can factor n into p and q can compute the unlocking exponent and read every message. The paper states this directly (sec. IX.A).

So RSA's security depends on factoring being hard. No known method factors a very large product of two primes quickly, while multiplying the two primes takes a computer a fraction of a second. But "no known method" is not "no possible method." No one has proved that fast factoring is impossible, and the paper itself says security rests "in part" on the difficulty of factoring (abstract). RSA's correctness is proved. Its security is a well-tested belief.

Conclusion

RSA makes locking public and unlocking private by building both keys from two secret primes. Encryption and decryption are each a power followed by a remainder, and a theorem guarantees that one undoes the other. Its security rests on the belief, so far unbroken but unproved, that factoring large numbers is slow.

This content reflects the field as of October 2026.

Key Terms

  • Encryption: The process of scrambling a message so that only someone with the right information can read it.
  • Public key: The information anyone can use to lock a message for a particular recipient, published openly.
  • Private key: The information only the recipient holds, which unlocks messages locked with the matching public key.
  • RSA: The public-key encryption method published by Rivest, Shamir, and Adleman in 1978, named for their initials.
  • Factoring: Finding the primes that multiply together to give a number.

References

  • Rivest, Ronald L., Adi Shamir, and Leonard M. Adleman. 1978. "A Method for Obtaining Digital Signatures and Public-Key Cryptosystems." Communications of the ACM 21 (2): 120–126. doi:10.1145/359340.359342.

Reading 4 min Done

Check Digits: Modular Arithmetic That Catches Typing Errors

Introduction

Every book has a 13-digit number on its back cover, and the last digit isn't part of the book's identity at all. It's there to catch mistakes. This reading explains how that final digit is chosen, works through the official example, and sets out what such digits can and can't do. Citations to the ISBN manual give section numbers.

The Last Digit Is a Check

An ISBN (International Standard Book Number) is a 13-digit number that identifies a book edition. Its first 12 digits carry information about the book and its publisher. The 13th is a check digit: a digit computed from the others and added to the end, so that errors in copying the number can be detected.

The ISBN rule uses a weighted sum, which means multiplying each digit by a fixed weight before adding. The first 12 digits are multiplied alternately by 1 and 3 (International ISBN Agency 2017, sec. A1.1). The check digit is chosen so that the weighted sum plus the check digit is divisible by 10. In the language of modular arithmetic, which keeps only remainders on division by a fixed number, the total must leave remainder 0 on division by 10. The manual calls this a "modulus 10" method (sec. 5.5).

The Manual's Own Example

The ISBN manual works the example 978-92-95055-12-4 (sec. A1.1). Its first 12 digits are 9, 7, 8, 9, 2, 9, 5, 0, 5, 5, 1, 2. Multiplying them by 1, 3, 1, 3, and so on gives

9 + 21 + 8 + 27 + 2 + 27 + 5 + 0 + 5 + 15 + 1 + 6 = 126

Divide 126 by 10 and the remainder is 6. The check digit is 10 - 6 = 4, which brings the total to 130, a multiple of 10. That 4 is the last digit printed. When the remainder is 0, the check digit is 0 instead of 10.

To check an ISBN someone hands you, you don't need to know how the check digit was chosen. Compute the weighted sum of all 13 digits, with the 13th digit weighted 1. If the total is divisible by 10, the number passes. If not, something was copied wrong.

The Same Idea on Store Shelves

Retail barcodes follow a similar scheme. The barcode on a book encodes the ISBN in the 13-digit EAN-13 format (International ISBN Agency 2017, sec. 13.2). Product numbers in that family end in a check digit too. The published method multiplies the digits by alternating weights of 3 and 1, adds the results, and takes as the check digit whatever is needed to reach the nearest equal or higher multiple of ten (GS1 n.d.). That's the same modulus 10 idea.

What Check Digits Do and Don't Do

Why use weights at all? If every digit had weight 1, swapping two digits would leave the sum unchanged, and a swap would go unnoticed. Alternating 1 and 3 makes each digit's position count.

Error detection means noticing that data has been changed or mistyped, without necessarily knowing how to fix it. That is the check digit's whole job. With the ISBN weights, any single mistyped digit always changes the total by an amount that isn't a multiple of 10, so it's always caught. Swapping two neighboring digits is caught too, except when the two digits differ by exactly 5.

A check digit doesn't correct errors. A failed check says that something is wrong, not which digit or what it should be. To fix the number, you go back to the source.

It also provides no security. The rule is public, and anyone can compute a valid check digit for any 12 digits they like. A number that passes the check is well formed, not genuine. Treating a check digit as protection against forgery confuses catching accidents with stopping deliberate tampering.

Conclusion

A check digit is chosen so that a weighted sum of all the digits leaves remainder 0 on division by 10. That catches every single-digit typo and nearly every swap of neighboring digits on ISBNs and retail barcodes. It detects mistakes; it can't repair them, and it offers no defense against someone who knows the rule.

This content reflects the field as of October 2026.

Key Terms

  • ISBN: The International Standard Book Number, a 13-digit number that identifies a book edition.
  • Check digit: A digit computed from the other digits of a number and added to the end, so that copying errors can be detected.
  • Weighted sum: A sum formed by multiplying each digit by a fixed weight before adding.
  • Error detection: Noticing that data has been changed or mistyped, without necessarily knowing how to fix it.

References

Reading 4 min Done

How Primes Are Spread Out: The Prime Number Theorem

Introduction

Primes get rarer as numbers grow, but they don't thin out at random. They thin out at a rate you can predict, and that predictability is what lets computers find the huge primes that encryption needs. This reading explains the pattern Gauss and Legendre noticed, the theorem that confirmed it, and what it means in practice.

A Pattern in the Tables

A prime is a whole number greater than 1 whose only positive divisors are 1 and itself. Below 100 there are 25 primes, one number in four. Between 1,000 and 2,000 there are 135, about one in seven. The fraction keeps falling.

Carl Friedrich Gauss and Adrien-Marie Legendre each made long tables of primes and looked for the rule behind the thinning. Gauss reportedly counted the primes in blocks of a thousand numbers whenever he had a spare quarter hour, and by one estimate had counted all the primes up to about 3 million by the end of his life (O'Connor and Robertson 2018). Both concluded that near a number n, roughly one number in every \ln n is prime.

The symbol \ln n stands for the natural logarithm of n: the power to which a particular constant, about 2.718, must be raised to give n. You don't need to compute it by hand. A useful rule is that the natural logarithm of 1 followed by k zeros is about 2.3 times k. So the natural logarithm of 1,000,000, which has six zeros, is about 13.8.

The Prime Number Theorem

What Gauss and Legendre had was an estimate: an approximate value based on evidence and reasoning, not an exact count. Turning it into a theorem took most of the 19th century. Chebyshev and Riemann made progress, and in 1896 Hadamard and de la Vallée Poussin proved it (O'Connor and Robertson 2018).

The prime number theorem says that near a large number n, the proportion of numbers that are prime is approximately 1/\ln n, and the approximation gets better, in proportion, as n grows. The density of primes near n is that proportion: the fraction of numbers in a stretch around n that are prime. The theorem doesn't say which numbers are prime. It says how many to expect in a stretch.

What It Means in Practice

Here is what the estimate predicts at several sizes.

Size of number\ln n, roughlyAbout one prime in every
1,0006.97 numbers
1,000,00013.814 numbers
1,000,000,00020.721 numbers
A 100-digit number230230 numbers

The predictions hold up well. In the 1,000 numbers just above one million, there are 75 primes, about one in 13. The estimate isn't exact for any particular stretch. Some stretches hold more primes than it predicts and some fewer, and the theorem describes the average. The table also shows how slowly the density falls. Going from numbers near 1,000 to 100-digit numbers multiplies the average gap between primes by only about 33.

Why It Matters for Encryption

The RSA encryption method needs two large secret primes. You can't look them up in a list, because there are far too many and the list would be public. Instead, a computer picks a random number of the right size and tests whether it's prime. Fast tests for primality exist, even though fast methods for factoring don't seem to.

The prime number theorem says how long that search takes. Rivest, Shamir, and Adleman used it in their 1978 paper: to find a 100-digit prime by testing random odd numbers, you should expect to test about 115 of them (Rivest, Shamir, and Adleman 1978, sec. VII.B). That's 230 halved, since skipping even numbers doubles the odds. Large primes are rare in proportion but plentiful in number, and a computer can find one quickly.

Conclusion

Near a number n, about one number in every \ln n is prime. Gauss and Legendre found that pattern in tables, and Hadamard and de la Vallée Poussin proved it in 1896 as the prime number theorem. It explains why the primes that encryption needs are easy to find even at hundreds of digits.

This content reflects the field as of October 2026.

Key Terms

  • Natural logarithm: The power to which a constant of about 2.718 must be raised to give a number; for a number n it is written \ln n, and for 1 followed by k zeros it is about 2.3 times k.
  • Estimate: An approximate value based on evidence and reasoning, not an exact count.
  • Prime number theorem: The theorem, proved in 1896, that near a large number n the proportion of numbers that are prime is approximately 1/\ln n.
  • Density of primes: The fraction of numbers in a stretch around a given size that are prime.

References

  • O'Connor, J. J., and E. F. Robertson. 2018. "Prime Numbers." MacTutor History of Mathematics Archive, University of St Andrews. Last updated January 2018.
  • Rivest, Ronald L., Adi Shamir, and Leonard M. Adleman. 1978. "A Method for Obtaining Digital Signatures and Public-Key Cryptosystems." Communications of the ACM 21 (2): 120–126. doi:10.1145/359340.359342.

Reading 4 min Done

Open Questions About Primes: Riemann, Twin Primes, and Goldbach

Introduction

Some of the hardest unsolved problems in mathematics can be stated in a single sentence. Three of them concern primes, and one carries a million-dollar prize. This reading sets out the Riemann Hypothesis, the twin prime conjecture, and Goldbach's conjecture, what is known about each, and one old problem about whole numbers that was finally solved.

What Counts as Open

A prime is a whole number greater than 1 whose only positive divisors are 1 and itself. A conjecture is a mathematical statement that is believed to be true, often on strong evidence, but has not been proved. In mathematics, evidence is not proof. A conjecture can hold for every case anyone has checked and still be false, or still be unproved.

The Riemann Hypothesis

The prime number theorem says that near a large number n, about one number in every \ln n is prime, where \ln n is the natural logarithm of n. That describes the average. Actual counts wander above and below it.

The Riemann Hypothesis is a precise claim about how evenly the primes are spread: it controls how far actual counts of primes can stray from the average. Bernhard Riemann formulated it in an 1859 paper. Its formal statement concerns where a function called the zeta function equals zero, and it says that all of its zeros of interest (the ones that aren't obvious) lie on one particular line (Clay Mathematics Institute n.d.-a). Loosely, it says the primes are spread about as regularly as they could be.

The Clay Mathematics Institute named it one of its seven Millennium Prize Problems, a list of major unsolved problems announced in 2000, each with a $1 million prize for a solution (Clay Mathematics Institute n.d.-b). The Institute lists it as unsolved.

Twin Primes

Twin primes are pairs of primes that differ by 2, such as 11 and 13, or 41 and 43. The twin prime conjecture says there are infinitely many such pairs. It is unproved.

For a long time, no one could prove even that infinitely many pairs of consecutive primes stay within any fixed distance of each other. In 2014 Yitang Zhang proved that there are infinitely many pairs of consecutive primes less than 70 million apart (Zhang 2014). That sounds far from 2, but it was the first fixed bound of any size. Later work by a large online collaboration of mathematicians, building on further advances, lowered the bound to 246 (Polymath 2014). The gap between 246 and 2 remains open.

Goldbach's Conjecture

Goldbach's conjecture says that every even number greater than 2 is the sum of two primes. For example, 4 = 2 + 2, 10 = 3 + 7, and 28 = 5 + 23. Christian Goldbach proposed it in a 1742 letter to Leonhard Euler (O'Connor and Robertson 2018).

Computers have checked it for every even number up to 4 \times 10^{18}, that is, 4 followed by 18 zeros (Oliveira e Silva, Herzog, and Pardi 2014). No counterexample has turned up. But no amount of checking covers all even numbers, and no proof is known.

A Settled Contrast: Fermat's Last Theorem

Not every old problem stays open. Pierre de Fermat claimed, around 1630, that no positive whole numbers a, b, and c satisfy a^n + b^n = c^n when n is a whole number greater than 2 (O'Connor and Robertson 1996e). For n = 2 there are many solutions, such as 3^2 + 4^2 = 5^2. Fermat wrote that he had a proof for higher powers, but none survives.

Andrew Wiles announced a proof in 1993. A gap was found, and he closed it in 1994, after months of work partly in collaboration with Richard Taylor (O'Connor and Robertson 1996e). The proof was published in 1995 (Wiles 1995). After more than 350 years, the claim was a theorem.

ProblemStatement in briefStatus as of October 2026
Riemann HypothesisThe primes are spread as evenly as a precise formula predictsOpen; Millennium Prize Problem
Twin prime conjectureInfinitely many pairs of primes differ by 2Open; infinitely many pairs of consecutive primes differ by at most 246
Goldbach's conjectureEvery even number above 2 is a sum of two primesOpen; checked up to 4 \times 10^{18}
Fermat's Last TheoremNo positive whole-number solutions to a^n + b^n = c^n for n > 2Proved by Wiles, published 1995

Conclusion

The Riemann Hypothesis, the twin prime conjecture, and Goldbach's conjecture are all open as of this writing. Each has strong evidence or partial results, and none has a proof. Fermat's Last Theorem shows that problems this old can fall, though it took more than three centuries and mathematics Fermat never knew.

This content reflects the field as of October 2026.

Key Terms

  • Conjecture: A mathematical statement believed to be true, often on strong evidence, but not yet proved.
  • Riemann Hypothesis: A precise claim, formulated by Riemann in 1859, about how evenly the primes are spread, controlling how far actual counts of primes can stray from the average.
  • Millennium Prize Problems: Seven major unsolved problems named by the Clay Mathematics Institute in 2000, each with a $1 million prize for a solution.
  • Twin primes: Pairs of primes that differ by 2, such as 11 and 13.
  • Goldbach's conjecture: The unproved claim that every even number greater than 2 is the sum of two primes.

References

  • Clay Mathematics Institute. n.d.-a. "Riemann Hypothesis." Millennium Prize Problems. Accessed October 13, 2026.
  • Clay Mathematics Institute. n.d.-b. "Millennium Prize Problems." Accessed October 13, 2026.
  • O'Connor, J. J., and E. F. Robertson. 1996e. "Fermat's Last Theorem." MacTutor History of Mathematics Archive, University of St Andrews. Last updated February 1996.
  • O'Connor, J. J., and E. F. Robertson. 2018. "Prime Numbers." MacTutor History of Mathematics Archive, University of St Andrews. Last updated January 2018.
  • Oliveira e Silva, Tomás, Siegfried Herzog, and Silvio Pardi. 2014. "Empirical Verification of the Even Goldbach Conjecture and Computation of Prime Gaps up to 4 \cdot 10^{18}." Mathematics of Computation 83: 2033–2060.
  • Polymath, D. H. J. 2014. "Variants of the Selberg Sieve, and Bounded Intervals Containing Many Primes." Research in the Mathematical Sciences 1: 12. doi:10.1186/s40687-014-0012-7.
  • Wiles, Andrew. 1995. "Modular Elliptic Curves and Fermat's Last Theorem." Annals of Mathematics 141 (3). doi:10.2307/2118559.
  • Zhang, Yitang. 2014. "Bounded Gaps Between Primes." Annals of Mathematics 179 (3): 1121–1174. doi:10.4007/annals.2014.179.3.7.

Guided Reading 7 min Done

Guided Walkthrough: How a Check Digit Catches a Typing Error in an ISBN

Introduction

A book's 13-digit ISBN ends in a digit whose only job is to catch mistakes. Seeing that digit at work shows modular arithmetic doing something practical, and it shows exactly where the method's limits lie. This walkthrough computes the check digit for a real ISBN, then tests it against two kinds of typing error and finds the one kind of slip it misses.

The Starting Point

An ISBN (International Standard Book Number) is a 13-digit number that identifies a book edition. The last digit is a check digit, computed from the first 12 so that copying errors can be detected. The rule uses a weighted sum: multiply the first 12 digits alternately by 1 and 3, then add. The check digit is whatever brings the total up to a multiple of 10 (International ISBN Agency 2017, sec. A1.1). Citations to the ISBN manual give section numbers.

Modular arithmetic is arithmetic that keeps only remainders on division by a fixed number, called the modulus. Here the modulus is 10. A valid ISBN is one whose full weighted sum, including the check digit with weight 1, leaves remainder 0 on division by 10.

The material for this walkthrough is the ISBN the manual itself uses as its example, 978-92-95055-12-4, and two mistyped versions of it:

  • The correct ISBN: 978-92-95055-12-4
  • A one-digit typo, with the 2 near the end typed as 7: 978-92-95055-17-4
  • Two neighbors swapped, with 92 typed as 29: 978-29-95055-12-4

The hyphens only separate parts of the number. They play no role in the calculation.

Walking Through the Check-Digit Calculation

Step 1: Compute the weighted sum of the first 12 digits

Write out the first 12 digits of the correct ISBN and the weights beneath them.

Digit978929505512
Weight131313131313
Product9218272275051516

Add the products: 9 + 21 + 8 + 27 + 2 + 27 + 5 + 0 + 5 + 15 + 1 + 6 = 126. That matches the manual's figure (sec. A1.1).

Step 2: Find the check digit

Divide 126 by 10. It goes in 12 times with remainder 6. The check digit is 10 - 6 = 4, the amount needed to reach 130, the next multiple of 10. That matches the 4 printed at the end of the ISBN.

To confirm the whole number, add the check digit with weight 1: 126 + 4 = 130. On division by 10, the remainder is 0. The ISBN passes. If the remainder in this step had been 0, the check digit would be 0, not 10.

Step 3: Change one digit and watch the check fail

Now take the typo version, 978-92-95055-17-4. Only the 12th digit has changed, from 2 to 7. That digit carries weight 3, so its product goes from 6 to 21, an increase of 15.

The weighted sum of the first 12 digits becomes 126 + 15 = 141. Adding the check digit 4 gives 145. On division by 10 the remainder is 5, not 0. The ISBN fails, and the error is caught.

That isn't luck. Changing one digit by an amount between 1 and 9 changes the total by that amount, or by three times that amount. Neither can be a multiple of 10. The numbers 1 to 9 aren't, and three times them gives 3, 6, 9, and so on up to 27, none of which is a multiple of 10 either. So every single-digit typo is caught.

Step 4: Swap two neighboring digits

Now take the swapped version, 978-29-95055-12-4. The 4th and 5th digits have traded places. The 4th position carries weight 3 and the 5th weight 1.

Before the swap, those positions contributed 9 \times 3 + 2 \times 1 = 29. After the swap, they contribute 2 \times 3 + 9 \times 1 = 15. The total drops by 14, from 126 to 112. With the check digit, the full sum is 112 + 4 = 116. The remainder on division by 10 is 6, so the error is caught.

Look at the size of the change: 14 is 2 \times 7, and 7 is the difference between the two swapped digits, 9 and 2. That holds in general. If neighbors a and b swap places, one moves from weight 3 to weight 1 and the other from weight 1 to weight 3. The total changes by 2 \times (a - b), up or down depending on which digit was in the weight-3 position.

Step 5: Find the one kind of swap that slips through

A swap goes undetected only if the change in the total, 2 \times (a - b), is a multiple of 10. For digits between 0 and 9, that happens only when a - b is 5 or −5, that is, when the two neighbors differ by exactly 5. (If they're equal, the swap changes nothing, so there's no error to catch.)

This ISBN has such a pair: the 8th and 9th digits are 0 and 5. Swap them and you get 978-92-95505-12-4. The 8th position carries weight 3, so its product goes from 0 to 15. The 9th carries weight 1, so its product goes from 5 to 0. The total rises by 10, from 126 to 136, and with the check digit it reaches 140. The remainder is 0. The mistyped number passes the check.

Key Considerations

The scheme works modulo 10, and that's why neighbors differing by 5 escape. A swap changes the total by twice the difference between the digits, and twice 5 is 10, which modular arithmetic modulo 10 can't see. Every other kind of single typo or neighbor swap changes the total by an amount that isn't a multiple of 10.

The common mistake is to treat the check digit as a security feature. It isn't one. The rule is published in the manual, and anyone can compute a valid check digit for any 12 digits. A number that passes the check is well formed. It isn't thereby genuine, and it may belong to no book at all. Check digits protect against accidents, not against anyone deliberately inventing a number.

A failed check also doesn't say which digit is wrong. The typo in Step 3 and the swap in Step 4 both fail, but nothing in the remainder points to the 12th digit or the 4th. To fix the number, you go back to the source.

Summary

The check digit makes the full weighted sum a multiple of 10. That catches every single-digit typo and every swap of neighboring digits, except a swap of two digits that differ by 5.

VersionWeighted sum with check digitRemainder on division by 10Verdict
978-92-95055-12-4 (correct)1300Passes
978-92-95055-17-4 (one-digit typo)1455Fails; error caught
978-29-95055-12-4 (neighbors 9 and 2 swapped)1166Fails; error caught
978-92-95505-12-4 (neighbors 0 and 5 swapped)1400Passes; error missed
  1. The first row reproduces the manual's own example: the first 12 digits give 126, and the check digit 4 brings the total to 130.
  2. The typo raised one weight-3 product by 15, which left remainder 5.
  3. Each swap changed the total by twice the difference of the swapped digits: −14 for 9 and 2, +10 for 0 and 5.
  4. Only a change that is a multiple of 10 goes unnoticed, which is why the last row slips through.

References

Guided Conversation 12 min Done

Weigh What Number Theory Guarantees

In this conversation you'll think through what you're actually trusting when you rely on encryption, and which of mathematics' claims about primes are proved and which are only believed. You'll leave with one thing number theory guarantees and one thing it only believes, stated in your own words.

You'll have this conversation with an AI assistant, using your own account. Choose a button to open a new chat with the prompt already filled in, then press send to start. If the chat opens empty, copy the prompt and paste it in.

Run this conversation in whichever assistant you already use:

Claude desktop app

To use another LLM, simply copy and paste the prompt into its chat window.

Show the full prompt (it lists misreadings to watch for, so skip it if you would rather come to the conversation fresh)
Guided Conversation: Weigh What Number Theory Guarantees (about 12 minutes)

Note to the learner: press send to start. Everything below is facilitator guidance for the AI. It lists misconceptions to watch for, so skip it if you'd rather come to the conversation fresh.

Please facilitate a reflective dialogue with me. I'm an adult who is comfortable with basic high-school algebra but may be rusty or uneasy with math, exploring what number theory is and whether to study it further. I'm studying how number theory is used in codes and cryptography, and which questions about primes are still open. Follow this guidance for the whole conversation.

GOAL
Explain, in my own terms, how number theory secures digital communication and why questions about primes remain open, separating what is proved from what is believed.

HOW TO RUN THE CONVERSATION
- Ask one question at a time, then wait for my reply. Keep each of your turns under about 120 words.
- Don't lecture. Explain a point only when I need it to continue, then return to my experiences and views.
- Be curious, collegial, and patient. Define terms briefly on first use (prime, encryption, public key, factoring, conjecture). Welcome disagreement when I give a reason.
- Plain conversation only: don't search the web or create files or documents.
- Aim for about 12 minutes. Spend the most time on topics 2 and 3. If my replies are brief, offer one concrete prompt, such as "think of the last time you paid for something online or logged in to your bank," and move on. If I seem uncertain, shorten the conversation to 5-7 minutes. Always reach the final topic.
- Start now. Open with one or two warm sentences: this is a conversation, not a quiz; my own reasons and reactions matter more than technical detail; I can ask you to clarify anything. Then ask me about a recent time I relied on encryption without thinking about it.

TOPICS, IN ORDER
1. Everyday trust. Ask about a time I relied on encryption, such as paying online or messaging. Ask what I think I was trusting: the company, the device, the mathematics? Follow-up: had I ever thought about how the lock icon works?
2. Proved versus believed. Explain briefly that RSA, a public-key method from 1978, builds its keys from two large secret primes; anyone can lock a message with the public key, and only the private key unlocks it. That unlocking returns the original message is proved. That breaking it requires factoring a huge number, and that factoring is slow, is believed, not proved. Ask how I feel about that gap. Follow-up: does a belief that has survived decades of attack feel different from a proof?
3. Open questions. Briefly describe three open problems: the Riemann Hypothesis (a precise claim about how evenly primes are spread, posed in 1859, with a 1 million dollar prize from the Clay Mathematics Institute), the twin prime conjecture (infinitely many prime pairs differing by 2, such as 11 and 13), and Goldbach's conjecture (every even number greater than 2 is a sum of two primes). Ask which one I find most surprising to still be open, and why. Follow-up: why might checking a huge number of cases not be enough?
4. Closing. Ask me to state one thing number theory guarantees and one thing it only believes. This sets me up to try a toy version of RSA with small numbers.

KEY POINTS TO KEEP ACCURATE
- RSA was published by Rivest, Shamir, and Adleman in 1978. Its correctness (decryption returns the message) is proved. Its security rests on factoring large products of two primes being hard, which is believed and unproved.
- Goldbach's conjecture has been checked by computer for every even number up to 4 x 10^18 (4 followed by 18 zeros). That is not a proof.
- In 2014 Yitang Zhang proved that infinitely many pairs of consecutive primes are less than 70 million apart. Later work lowered that bound to 246. The twin prime conjecture itself (a gap of 2) remains open.
- The Riemann Hypothesis is unsolved and is one of the Clay Mathematics Institute's Millennium Prize Problems, each with a 1 million dollar prize.
- Fermat's Last Theorem, by contrast, was proved by Andrew Wiles, published in 1995.

MISCONCEPTIONS TO CORRECT GENTLY
When one appears, name the accurate version briefly, then return to my views.
- "Encryption is unbreakable in principle": it rests on assumptions, such as that factoring is hard, that haven't been proved.
- "If a computer checked trillions of cases, it's proved": checking cases, however many, isn't proof; a proof must cover every case.
- "The Riemann Hypothesis is about finding the largest prime": there is no largest prime; the hypothesis is about how primes are distributed.

LIMITS
- Don't give advice on security practices, passwords, or products.
- Don't make claims about quantum computing or timelines for breaking encryption.
- Don't present any open problem's status beyond what's stated here.

TO FINISH
After my closing answer, close in one short turn:
- Affirm one specific thing I worked out, in my own words where possible.
- Suggest one or two next steps that fit how the conversation went. Possible steps: try encrypting and decrypting a small number with toy RSA; look up the Clay Mathematics Institute's description of the Riemann Hypothesis; review how remainders work.
- Restate my two statements on their own lines, labeled "Guaranteed" and "Believed", so I can copy them.

Hands-on Activity 15 minOptional Done

Encrypt and Decrypt a Message with Toy RSA

Overview

This optional activity lets you run the RSA encryption method yourself, with primes small enough for a phone calculator. RSA locks a message by raising it to a power and keeping the remainder on division by a public number, and unlocks it the same way with a different, secret power. You'll encrypt a number, decrypt it, and see how the method depends on keeping remainders small.

What You'll Need

  • A calculator (a phone calculator is enough)
  • Paper and a pen

Your Task

Use the primes 3 and 11 to set up a toy RSA system. Encrypt the message 4, decrypt it again, then repeat with a message of your own. Finish with two sentences on what would make the system hard to break with real-sized primes.

Steps

  1. Set up the keys. The two primes are p = 3 and q = 11, so the public number is n = 3 \times 11 = 33. The public exponent is 3 and the private exponent is 7. Write these down.
  2. Encrypt the message 4. Compute 4^3 = 64. Divide 64 by 33 and find the remainder: 64 = 1 \times 33 + 31, so the remainder is 31. The encrypted message is 31.
  3. Decrypt 31 in stages. Decrypting means computing 31^7 and taking the remainder on division by 33. Don't compute 31^7 directly. Multiply by 31 one step at a time, and after each multiplication replace the result with its remainder on division by 33. Start: 31. Next: 31 \times 31 = 961, and 961 = 29 \times 33 + 4, so keep 4. Continue for seven factors of 31 in all, and record the remainder at each stage.
  4. Encrypt and decrypt a second message. Choose a whole number between 2 and 32. Encrypt it by cubing it and taking the remainder on division by 33. Then decrypt the result with the same staged method, using seven factors and reducing after each step.
  5. Write two sentences on what would make this system hard to break if the primes had hundreds of digits instead of one or two.

What to Expect

In Step 3, the remainders after each multiplication should run 31, 4, 25, 16, 1, 31, 4. The last one, 4, is your original message.

To find a remainder on a calculator, divide by 33, note the whole-number part, multiply it by 33, and subtract from the number you started with. For example, 961 divided by 33 is about 29.1, and 961 - 29 \times 33 = 4.

Your second message should come back unchanged after decryption. With numbers this small, a few messages, such as 10, 11, and 12, encrypt to themselves. That's a quirk of the tiny public number, not a mistake in your arithmetic.

For your two sentences, the key fact is that anyone who can split the public number into its two primes can work out the private exponent. Splitting 33 into 3 \times 11 takes seconds. For a public number hundreds of digits long, no known method does it in any practical amount of time, though no one has proved that such a method can't exist.

Self-Check

When you're done, check that:

  • You got 31 when you encrypted 4.
  • Your decryption of 31 returned 4.
  • You reduced by 33 after each multiplication instead of computing a huge number.
  • Your second message came back unchanged after encryption and decryption.

Nothing is uploaded. Write in your own notebook or document and keep it.

Knowledge Check 10 min Done

Codes, cryptography, and the Riemann Hypothesis

This ungraded knowledge check assesses your understanding of how number theory is used today and what it hasn't yet settled. You'll be asked about public-key encryption and RSA, check digits, the prime number theorem, and the status of the Riemann Hypothesis, twin primes, and Goldbach's conjecture.

Note: Use this to test yourself, review the feedback on any questions you miss, and retry until you feel confident before moving forward.

5 questions · ungraded · retry as often as you like

Graded Quiz 30 min Done

Number Theory

This graded quiz assesses your understanding of how number theory reasons about whole numbers and what it does in the world. You'll be asked about the history of number theory, divisibility and prime factorization, modular arithmetic, Euclid's proof that there are infinitely many primes, RSA encryption, check digits, the prime number theorem, and open problems about primes.

Note: Aim for a score of 80 percent or higher. If you score lower, use the feedback to review the topics you missed, then retake the quiz.

10 questions · target score 80% · 3 forms, rotated on each attempt