cipher.ink Write a message

Puzzles · Puzzle series

The Prime Hunt: eight prime number puzzles

Eight puzzles with one numeric answer each: a mirror prime, an emirp, a chain, a number that fools Fermat, a hidden prime and more.

Prime Hunt is eight puzzles about primes, each with a single numeric answer you can reach with a pencil, a bit of cleverness and a primality checker. Some ask you to find a number, one asks you to spot the only prime among six look-alikes, and one asks for a number that lies to the most famous primality test. The answers aren't in the page. Each is checked by comparing hashes, and nothing you type is sent anywhere.

Your progress is remembered in this browser only, if it allows it. The page works without that. Each puzzle has a scratchpad that runs the same number card as the prime checker, so you can test candidates without leaving.

What the eight are about

The list below says what each puzzle is about, never the answer.

  1. The mirror prime. A five-digit palindromic prime with a given digit sum, and the reason there are no four-digit ones (every palindrome with an even number of digits is a multiple of 11).
  2. Prime backwards, too. The first emirp above 1000, a prime that reversed is a different prime.
  3. A chain of primes. A Cunningham chain: double a prime and add 1, and keep going while it stays prime. How early does a chain of six occur?
  4. The number that lies. The smallest Carmichael number, a composite that passes Fermat's primality test for every base, and why modular exponentiation is the engine behind that test.
  5. Hidden in the grid. One prime among six look-alikes, with the quick divisibility tests that get rid of most of them.
  6. The first gap of fourteen. How far apart consecutive primes can be, and the first place the gap is 14. See also twin primes for the other extreme.
  7. The Mersenne that isn't. The smallest prime exponent whose Mersenne number is composite. The record primes on the largest known prime page are all of this form.
  8. Every digit once. The largest prime that uses the digits 1 to 7 exactly once, and a digit-sum argument for why the question stops at seven digits.

Why hash the answers, and what it means

If the answers sat in the page, the first person to open the source would have them. So the page holds the SHA-256 of each answer's digits and compares the hash of what you type. That keeps the answers out of casual reach, but it isn't a secret. A number answer has few candidates, and a computer can try them all. The Cipher Ladder uses this as its level 13 and shows exactly how fast the attack is, and what a slow hash would cost the attacker instead.

Common questions

May I use a program?

Yes. The checker is there to be used, and a ten-line loop is a fine way to solve puzzles 2, 3, 6, 7 and 8. Puzzle 4 is also easy to program once you know what a Carmichael number is. The puzzles are meant to teach you what to check, and a program is just a faster pencil.

My answer is rejected.

Enter digits only. Commas, spaces and underscores are ignored, but anything that isn't a number isn't an answer. Check that you read the question exactly, for example "smallest above 1000" and not "smallest".

Is my progress saved?

In your browser's local storage, on this device only, if it allows it. Clearing the site data starts you again. Nothing is sent to a server.

Where do I learn the background?

Start with the primes hub and the sieve, then Goldbach and the Riemann hypothesis for the open questions.

Further reading

  1. OEIS A002385: palindromic primes
  2. OEIS A006567: emirps
  3. OEIS A005384: Sophie Germain primes (the start of each Cunningham chain link)
  4. OEIS A002997: Carmichael numbers
  5. OEIS A005250: record prime gaps
  6. OEIS A000043: exponents of Mersenne primes