← All projects / Carryless Base 3
Writing a number differently never changes which numbers are prime. Changing how multiplication works does. Take base 3 without a zero, multiply the school way, and throw the carries away: the result is a number system with primes of its own.
Use the digits 1, 2 and 3. After 3 comes 11, then 12, 13, 21. When a digit would go past 3 it wraps back to 1 and carries one, as in base 13 without a zero. With the ordinary carry, this is just another way of writing the counting numbers, and its primes are the ordinary primes.
| Decimal | No-zero base 3 | Decimal | No-zero base 3 | Decimal | No-zero base 3 |
|---|
Multiply 12 by 12 (that is, 5 by 5). The column totals are 1, 4, 4.
1 2
× 1 2
-----
2 4 12 × 2
1 2 12 × 1, shifted
-----
1 4 4 column totals
carry them: 2 2 1 = 25 (5 × 5, as usual)
drop them: 1 1 1 = 13 (each 4 wraps to 1)
13 is 111 in base 3, and carryless it is 12 ⊗ 12. The ordinary prime 13 splits into 5 ⊗ 5.
Anything times 3 wraps to 3, and adding 3 changes nothing. The zero that was removed from the digits comes back the moment the carries go. A number that starts with 3 is a shorter number with a leading zero: 311 is just 11.
4 wraps to 1, so 2 behaves like −1. Swap every 1 and 2 in a number and you get its mirror twin, which factors the same way. 11 and 22 are twins; so are 12 and 21.
A carryless prime is a number that can't be written as a carryless product of two shorter numbers. One-digit numbers don't count: 1 and 2 act like 1 and −1, and 3 is the zero.
| Digits | Carryless primes | Mirror pairs |
|---|
Every number splits into carryless primes in exactly one way, apart from the mirror swap. Carryless base 3 is arithmetic on polynomials whose coefficients wrap at 3, and its primes are the irreducible polynomials.
Nobody can say how many ordinary primes have 10 digits without finding them. Here there is a formula (Gauss's count of irreducible polynomials), and the table above matches it. Even the Riemann hypothesis has a carryless version, and that one was proved decades ago.
Building the table…
Ordinary primes have no formula that hands you the nth one without a search, and the simple estimates drift. Carryless primes come with exact tools. Put together, they give every carryless prime with no error at all.
The number of carryless primes with L digits is 2 × I(L − 1), where I(d) = (3d minus the corrections for each divisor of d) ÷ d. For a prime d it is simply (3d − 3) ÷ d. This is Gauss's count of irreducible polynomials.
Multiply together every carryless prime of one length that starts with 1 (one of each mirror pair). The answer is always written in nothing but 1s and 3s. When the length is one more than a prime d, it is 1313…131 with (3d − 1) ÷ 2 ones.
A number of that length that starts with 1 is a carryless prime exactly when it carryless-divides that 1s-and-3s number. No composite gets through, unlike the Fermat test for ordinary primes, which 341, 561 and 76 more composites below 100,000 fool. For 3 and 4 digits the test is a digit rule: the last digit is not 3, and neither the digit sum nor the alternating digit sum is a multiple of 3.
| Digits | Primes starting with 1 | Their carryless product | Checked |
|---|
Steps 3 and 4 still test numbers one by one. This step doesn't test anything. For each length, fix one carryless prime m (the table below gives one for every length up to 11 digits) and call a root of it α. Then:
Every Lyndon word gives a different prime, and together they give every carryless prime of that length that starts with 1. Swap the 1s and 2s to get the other half. The two-digit primes are 11, 12 and 13. To plug in n: find L and r from the counts, take the r-th Lyndon word of length L − 1 (or, if r is past the halfway point, the one that many places into the second half, then swap 1s and 2s).
| Digits | Fixed prime m | Lyndon words | Primes made | Every prime of that length, once |
|---|
Building the table…
Skip the test in step 3 and assume the primes of each length are spread evenly over their block: the nth is about s + (r − ½) ÷ i × 3L−1, where s is the first L-digit number and i the number of primes per half-block (start the second half one block later). Past n = 10,000 it lands about 0.02% away, about 35 numbers. The usual estimate for ordinary primes, n(ln n + ln ln n − 1), is about 0.4% away there. Carryless primes really are spread that evenly, which is the proved carryless Riemann hypothesis at work.
Take the carryless primes that are not ordinary primes, one from each mirror pair, and compare them with every other composite number that starts with 1.
| Property | Carryless-only primes | Other composites |
|---|
Apart from 13 and 23 themselves (6 and 9), a carryless prime never ends in 3, because ending in 3 means 13 is a carryless factor. A number that doesn't end in 3 is never a multiple of 3.
Since 3 is one less than 4, a number's remainder by 4 comes from its alternating digit sum. For a carryless prime that sum can never be a multiple of 3, which rules out its most common value, 0, and with it half the multiples of 4.
11…1 with k ones is a carryless prime exactly when k is prime and the powers of 3 go through every remainder on dividing by k.
| Ones | Value | Carryless prime | Rule says | Ordinary prime |
|---|
The numbers that are prime both ways start 5, 7, 17, 19, 29, 41 … and the first gaps two apart repeat: 17 − 5, 19 − 7 and 29 − 17 are all 12. The run ends at the next pair (41 − 19 = 22). Tested across all of them against random samples of ordinary primes the same size:
| Test | Prime both ways | Random ordinary primes |
|---|
Both sit inside the random range. Membership needs two things, being a carryless prime and being an ordinary prime. The first has a fast exact test; nothing in the carryless world predicts the second.
Numbers run left to right, then down, from 1 in the top left. A lit cell is a number in the chosen set. At 13 wide each column holds one remainder by 13; at 12 wide the ordinary primes line up in four columns; at 27 wide the base 3 structure of the carryless primes shows.
Touch a cell for its number.
Flip results: the nth number that is prime both ways, with its low bits flipped by the nth piece of the stack 0, 1, 10, 010, 1010, …. The results are prime about as often as random odd numbers.
| Carryless base 3 | Carryless base 13 | Carryless base 12 |
|---|
12 = 4 × 3, so a carryless base 12 number is secretly a wrap-at-4 number and a wrap-at-3 number at once. 3 ⊗ 4 = C, the zero. The ordinary prime 73 (written 61) acts like 1, because 61 ⊗ 61 = 1. And 300 (1CC) is 1C ⊗ 1C and also 16 ⊗ 16.
Dropping the carries gives clean primes and unique factoring exactly when the base is prime: 2, 3, 5, 7, 11, 13. With the ordinary carry every base is fine and gives the ordinary primes.
A carry rule says what 3 in one column is worth somewhere else. The rules that keep arithmetic working each quietly pick a number system.
| Carry rule | What it really is | Primes |
|---|---|---|
| 3 carries as 1 into the next column | ordinary whole numbers | the ordinary primes |
| 3 carries as −1 | base −3 | the same primes, spelled differently |
| 3 carries as 2 | base 3/2, numbers with halves | almost the same: only 2 stops being prime |
| Drop the carries | polynomials that wrap at 3 | a new set, this page |
| 3 carries as 1 two columns over | numbers a + b√3 | about half the primes split: which ones |
A carry rule picked at random usually breaks arithmetic itself (a × b stops matching b × a), and then "prime" stops meaning anything.
Unique factoring, exact counts, fast tests. Carryless multiplication in base 2 runs inside checksums and web encryption, and processors have an instruction for it.
Only 13% of ordinary primes are carryless primes, and carryless primes are only a little more likely than average to be ordinary primes. All of that boost comes from skipping multiples of 3. Carrying is exactly what makes the ordinary primes hard.