Primes ยท Prime numbers
Is my name prime?
Read a name as a number, check it, find the nearest prime names, and see the code that gives every anagram the same number.
What you type stays in your browser.
Type a name and this tool reads it as a number, tells you whether that number is prime, and gives the nearest primes written back as names. Each letter is a digit in base 36, with 0 to 9 as themselves and A as 10 up to Z as 35. BOB comes out as 15,131, which is prime. ADA is 13,438, an even number, so it isn't. Further down is a second way of turning words into numbers, one that gives anagrams the same number.
Reading a name as a number
We usually write numbers in base 10, where 427 means 4×100 + 2×10 + 7. Base 36 does the same with 36 symbols. B is 11 and O is 24, so BOB is 11×36² + 24×36 + 11 = 15,131. Once a word is a number, you can ask every question you'd ask of any number: is it prime, what are its factors, what are its neighbors. The checker card supplies the factors, the labels and the nearest primes here.
What share of names come out prime? The prime number theorem predicts about 1 in ln n for numbers near n. Among all the three-letter strings, up to 36³ = 46,656, 10.3% are prime, which is close to the 9.9% the formula gives (scripts/examples/birthday-name-examples.mjs). Longer names are less likely to be prime. A typical 7-letter name is a number around 4 × 1010, and about 1 in 25 numbers that size is prime. Of the names tried in that script, only BOB is prime. EULER (24,942,051), HYPATIA and CIPHER are all composite, and the tool will tell you what they factor into.
The nearest prime to your name
There's a prime near every number (the gaps between primes grow slowly, so you're never far from one), so your name has a closest prime above it and below it. The tool writes them back in base 36, giving you "prime names" next to yours. They're usually not words. The idea is the one the Ulam spiral shows from another side: primes are everywhere, and you can't predict them from the digits.
A second code: letters as primes
There's a neater way to turn a word into a number, and it uses primes in a different role. Give each letter its own prime: A = 2, B = 3, C = 5, D = 7 and so on up to Z = 101. Multiply the primes of the letters. LISTEN becomes L (37) × I (23) × S (67) × T (71) × E (11) × N (43) = 1,914,801,911, and so do SILENT and ENLIST. Multiplication ignores order, so every anagram of a word has the same number, and by unique factorization (the reason 1 is not prime) two words that aren't anagrams never do. Factor the number and you get back the multiset of letters.
Gödel numbering
The version of this idea that kept the order of the letters is older and more famous. In 1931 Kurt Gödel needed to talk about mathematical statements using arithmetic itself. He gave each symbol a number and encoded a sequence of symbols as 2a × 3b × 5c × …, with the first symbol's number as the exponent of the first prime, the second symbol's number as the exponent of the second prime, and so on. Unique factorization means you can read the sequence back from the number. A statement about formulas then becomes a statement about whole numbers, and that step made his incompleteness theorems possible. The tool shows the Gödel number of your name using A = 1 to Z = 26: for CAB it would be 23 × 31 × 52 = 600.
Is this a cipher?
No, and the reason matters. Neither encoding hides anything. Anyone can factor the number, and a name is short, so the factoring is instant. They're encodings, like base64, which changes the form of data without protecting it. The cipher.ink product uses no primes at all (AES-GCM and PBKDF2 need none), but the idea that factoring can reverse a code is the same one that gives RSA its strength once the numbers are 600 digits long.
Common questions
Does capitalization or punctuation matter?
No. The tool folds letters to lower case, removes accents (so é becomes e) and ignores spaces and punctuation, so "Ada Lovelace" and "adalovelace" give the same number. Digits count in the base-36 reading and not in the letter-prime code.
Why base 36?
It's the largest base that the digits and the English alphabet can write: 10 digits plus 26 letters. JavaScript and Python both read it directly.
My name is long. What happens?
Up to 40 letters are accepted, which is a number of about 62 digits. The primality test is instant at that size, though the factoring step may stop early and say so.