Prime numbers so memorable that people hunt for them

2025-01-1814:41185103www.scientificamerican.com

Math enthusiasts challenge one another to find special prime numbers, including those that are palindromes and Smarandache numbers

One of my favorite anecdotes about prime numbers concerns Alexander Grothendieck, who was among the most brilliant mathematicians of the 20th century. According to one account, he was once asked to name a prime number during a conversation. These numbers, which are only divisible by 1 and themselves, form the atoms of number theory, so to speak, and have fascinated humankind for thousands of years.

Grothendieck is said to have replied: “57.” Although it is hard to determine the truth of this story, 57 has since been known in nerd circles as the Grothendieck “prime number”—even though it is divisible by 3 and therefore not a prime number.

A similar conversation that mathematician Neil Sloane overheard during a meal between two of his colleagues, Armand Borel and the late Freeman Dyson, had a more exciting outcome. Borel asked Dyson to name a prime number and, unlike Grothendieck, Dyson provided a number that is only divisible by 1 and itself: 231 – 1. But that reply did not satisfy Borel. He wanted Dyson to recite all of the digits of a large prime number. Dyson fell silent, so after a moment, Sloane jumped in and said, “1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1.”

On supporting science journalism

If you're enjoying this article, consider supporting our award-winning journalism by subscribing. By purchasing a subscription you are helping to ensure the future of impactful stories about the discoveries and ideas shaping our world today.

The number 12,345,678,910,987,654,321 is indeed prime. It consists of 20 digits and is really easy to remember: count to 10 and then count backward again until you get to 1. But it has been unclear whether other primes take the palindromic form of starting at 1, ascending to the number n and then descending again. Sloane calls them “memorable” primes—and they can be presented as 123 ... (n – 1)n(n – 1) ... 321. For n = 10, you get the number mentioned by Sloane. But are there other n’s for which the result is a prime number? Dyson, Borel and Sloane must have had a lively conversation about all this.

Sloane was particularly interested. He created a database of number sequences in 1964 that eventually formed the backbone of the Online Encyclopedia of Integer Sequences (OEIS), which was launched in 1996. On the OEIS website, experts compile all kinds of facts about number sequences and discuss them. Sloane himself was happy to take part in the discussions and repeatedly initiated research questions, and this online activity eventually led to the hunt for memorable and similar prime numbers.

Is There an Infinite Number of Memorable Primes?

In 2015 Indian engineer Shyam Sunder Gupta, who has been fascinated by prime numbers since childhood, discovered that the number 123 ... (n – 1)n(n – 1) ... 321 for n = 2,446 is a prime number. He did not publish this in a mathematical journal but announced the result through a mailing list used in number theory for discoveries of this kind. The resulting prime number has 17,350 digits.

“Since prime numbers are very useful in secure communication, such easy-to-remember large prime numbers can be of great advantage in cryptography,” Gupta says. “That’s why I’m enthusiastic about this type of prime number.”

Whether there are other memorable primes is not yet known. Mathematicians have checked all cases up to n = 60,000; apart from 10 and 2,446, no others have been found. But experts suspect that more exist, even if they cannot prove it.

Some argue that there should be an infinite number of primes of this type. Such “heuristic” arguments assume that prime numbers are randomly distributed across the number line and determine how likely it is that a certain type of number (in this case the palindrome 123 ... 321) is prime. Although these considerations are not incontrovertible proof, they at least provide an incentive for further research. Gupta, for one, is convinced that there should be an infinite number of such palindromes, even if they are rare.

Other Types of Memorable Primes

On September 29, 2015, about two months after Gupta shared his result, Sloane posted a call to the number theory mailing list to challenge others to find another variety of memorable prime in which numbers simply ascend until they hit a final digit n: 123 ... (n – 2)(n – 1)n. To be prime, such a number cannot end with an even digit or a 5, which excludes 60 percent of all n from the outset. Yet even in this case, heuristic arguments suggest an infinite number of such prime numbers exist.

In response to Sloane’s call, some prime number enthusiasts fired up their computers and began to systematically search for a Smarandache prime number, as these particular primes are called. After none appeared even for five-digit values of n, Sloane turned to the Great Internet Mersenne Prime Search team. This is a collaborative project in which volunteers make their computing power available to search for prime numbers. A group from the Mersenne prime search team liked Sloane’s idea, and the search for Smarandache primes was launched under the name Great Smarandache PRPrime search. But after no prime number appeared through n = 106, the project was abandoned.

At first glance, the lack of results seemed surprising. The number 1,234,567,891 is a prime number—but 12,345,678,910, an even number, is not. If we take into account the restrictions that exist—a prime number cannot be divisible by 2, 3, 4, and so on—we can estimate that no prime number should appear among all numbers of the form 123 ... n from n = 1 to n = 106. At least, that is what a calculation by computer scientist Ernst Mayer suggests. According to this, the expected number of Smarandache primes up to n = 106 is around 0.6. “So I would like to encourage the world to keep going and find this missing prime,” Sloane said in a Numberphile YouTube video.

Even though there has been little progress on this front, Sloane has encouraged people to stay curious. In 2015, for example, he urged one of his colleagues—computational biologist Serge Batalov—to seek a reverse Smarandache prime number. He noted that writing out numbers in descending order (for example 4321) had revealed two such primes to date: 82818079 ... 321 and 3776537764 ... 321.

“Can you get one more term? This might be child’s play for you!” he wrote.

Batalov’s response: “Challenge accepted!”

These reverse Smarandache primes all inevitably end in 1, meaning far fewer candidates are eliminated from the outset. Yet to date, Batalov, who has contributed many insights into similar prime number problems, has not found any novel examples of this memorable variety.

Gupta has also contributed to the search but to no avail. In 2023 software developer Tyler Busby stated that for the third prime number in the sequence, n must be greater than 84,300 for n(n – 1) ... 321.

How and whether the hunt will continue is still unclear. It is mostly amateur mathematicians who take part—not professional number theorists. That’s because prime numbers of this type do not provide any immediate new mathematical insights.

Nevertheless, Sloane is not giving up. Now age 85, he continues to spread his enthusiasm for mathematics and numbers and to motivate people to have fun with it, too. He certainly does not need to convince Gupta: “I’m still looking for all kinds of large prime numbers that are easy to remember,” Gupta says. And every now and then he finds one.

This article originally appeared in Spektrum der Wissenschaft and was reproduced with permission.


Read the original article

Comments

  • By tkgally 2025-01-2123:543 reply

    My family’s phone number when I was a child was both a palindrome and a prime: 7984897.

    My parents had had the number for two decades without noticing it was a palindrome. I still remember my father’s delight when he got off a phone call with a friend: “Doug just said, ‘Hey, I dialed your number backwards and it was still you who answered.’ I never noticed that before!”

    A few years later, around 1973, one of the other math nerds at my high school liked to factor seven-digit phone numbers by hand just for fun. I was then taking a programming class—Fortran IV, punch cards—and one of my self-initiated projects was to write a prime factoring program. I got the program to work, and, inspired by my friend, I started factoring various phone numbers. Imagine my own delight when I learned that my home phone number was not only a palindrome but also prime.

    Postscript: The reason we hadn’t noticed that 7984897 was a palindrome was because, until around 1970, phone numbers in our area were written and spoken with the telephone exchange name [1]. When I was small, I learned our phone number as “SYcamore 8 4 8 9 7” or “S Y 8 4 8 9 7.” We thought of the first two digits as letters, not as numbers.

    Second postscript: I lost contact with that prime-factoring friend after high school. I see now that she went on to earn a Ph.D. in mathematics, specialized in number theory, and had an Erdős number of 1. In 1985, she published a paper titled “How Often Is the Number of Divisors of n a Divisor of n?” [2]. She died two years ago, at the age of sixty-six [3].

    [1] https://en.wikipedia.org/wiki/Telephone_exchange_names

    [2] https://www.sciencedirect.com/science/article/pii/0022314X85...

    [3] https://www.legacy.com/us/obituaries/legacyremembers/claudia...

    • By tkgally 2025-01-223:48

      > In 1985, she published a paper titled “How Often Is the Number of Divisors of n a Divisor of n?”

      Claudia Spiro seems to have remained actively interested in prime numbers into her sixties. In 2017, she published a paper titled “On three consecutive prime-gaps”:

      https://projecteuclid.org/journals/rocky-mountain-journal-of...

    • By dhosek 2025-01-224:101 reply

      I thought everybody factors phone numbers. I also factor the odometer reading in my car while driving.

      • By noman-land 2025-01-2221:131 reply

        How do you do mental factoring?

        • By dhosek 2025-01-2223:013 reply

          I don’t usually keep the factors, but I have a variety of techniques. Putting aside the trivial cases of divisibility by 2, 3, 5, 11¹ and 37², a lot of it comes down to find ways to make the numbers smaller, so, for example. my current odometer reading is 13,857. To test for divisibility by 7, I can turn that into 14,000-13852=143 which I can tell at a glance isn’t divisible by 7. It is divisible by 3, so I can reduce it to 4619 which isn’t divisible by 3 and I can also tell it’s not divisible by 11. I can also rule out 19 at a glance. To check 13, I might do my right-side divisibility test where I start by subtracting 39 from the right, which gives 458. I could continue with that, but taking 39 from the left gets me to a small enough number faster of 68 which isn’t divisible by 13. Right-side divisibility for 17 takes 119 from the right leaving 45 which isn’t divisible by 17. For 23, I can do a left-side removal of 46 to rule that out. 29, go right to bring it to 459 and then 43, not divisible by 29. For 31, I’ll do right side to get 434 and then 31 so 4619=149×31 and 149 is prime and I’m done.

          1. To check for divisibility by 11, subtract the sum of even numbered digits from the sub of odd numbered digits. If 11∣n, then you’ll have a multiple of 11. E.g., for 13,857, we compare (3+5)-(1+8+7)=-8 which is not a multiple of 11.³

          2. To check for divisibility by 111, we take advantage of the fact that 3×37=111, 27×37=999 and thus 1000≡1(mod 37) and we can then add up the digits in groups of 3, and pull out the most convenient multiple of 111 to see if we have 0, 37 or 74. E.g., with our example about, 13+852=865-888=-23 which is not a multiple of 37.

          3. As an added bonus that number is the remainder when dividing by 11. Similarly the number I get with the check in footnote 2 is the remainder when dividing by 37.

          • By flancian 2025-01-232:071 reply

            Hello fellow hobby factorizer :)

            I wanted to share this small gem of a paper in case it helps you like it's helped me:

            "Simple divisibility rules for the 1st 1000 prime numbers": https://arxiv.org/pdf/math/0001012

            • By dhosek 2025-01-235:02

              Meh, most of those aren’t all that helpful. Multiplying the last digit by -17 and adding that to the rest of the number to do a divisibility test for 19? I’d be more inclined to do the right-side reduction which isn’t appreciably different and, if you’re good at keeping some side numbers in working memory can give you the actual quotient if it is divisible which these rules won’t give you.

          • By tkgally 2025-01-2223:531 reply

            Interesting! What do you do when you try to factor a large number that doesn't yield to any of your mental factoring techniques? It might be prime, after all, or composite with only large prime factors. Do you give up after a while? Run it through a factoring program? Keep plugging away until you get to the number's square root?

            • By dhosek 2025-01-234:53

              With the odometer I have a time limit to factor the number (around one minute on the highway, up to four on surface streets). I usually have no problem factoring a four digit number (time in 24-hour format) within the minute given, especially since the worst case scenario would be 22:09=47×47. When factoring, it’s less about recognizing the primes as the key composites once you get down to four digits or less, which usually happens surprisingly quickly.

          • By CurtMonash 2025-01-2412:14

            My first step would be to note that 13,857 is divisible by 7 if and only if 1385 is. But yes, my second step would be a lot like yours, in my case subtracting from 1400.

    • By tkgally 2025-01-2211:521 reply

      Follow-up: My formal study of programming stopped with that Fortran IV class a half century ago, but LLMs now delude me into thinking I can program. I just had Claude write me a Python program to list all of the seven-digit numbers that are both primes and palindromes. It found 668: 1003001, 1008001, 1022201, 1028201, 1035301, ...

      • By jodrellblank 2025-01-232:341 reply

        I wondered if we map English letters to digits (a=0, b=1, c=2, ... , z=25) is there anything which is both a palindrome in its English form and in its number form, and prime? I took a list of palindromes from Wikipedia[1] and tested them, and yes:

        deified 3485843

        bib 181

        did 383

        I note that none of them use letters which map to double-digits (k=10, l=11, m=12, etc.); none of the palindrome sentences make palindromic numbers (ignoring case, stripping all punctuation); could there be one which does?

        [1] https://en.wiktionary.org/wiki/Appendix:English_palindromes

        • By tkgally 2025-01-235:001 reply

          How about representing the words as numbers in base 26? That would preserve the palidromicity for both the word and the number, and primality would not be affected by the base representation.

          Might not be as much fun, though.

          • By jodrellblank 2025-01-237:161 reply

            Retesting the words like that does find some: REPAPER/5305958597, DUD/2551, DID/2239, LEMEL/5105267, PEEWEEP/4683479543.

            With this hackish code to interpret the text as base 26, rebase that to base10, test primality, I can't test the sentences (I think it might be overflowing on the higher value words, even). I think it's not so fun if the base 10 numbers are not palindromic.

            • By tkgally 2025-01-2310:571 reply

              Thanks for trying! I was thinking of creating a set of digits for base 26 using emoji or other Unicode characters. Then the numbers would at least look like palindromes. But I don't know how interesting palindromes in an ad hoc character set would be.

              • By jodrellblank 2025-01-2413:40

                My view on that is that DEIFIED is seven symbols, and I was treating those as the 'Unicode' set of digits for base 26. Swapping them out for different symbols would only change the presentation, e.g. adding a +600 offset in Unicode codepoints to each character gives ʜʝʡʞʡʝʜ but ... the same thing just in a different presentation, so not a very useful transform.

                Treating the word as a base 26 number means that if the word is palindromic, the number is too since they're the same thing, so that's a single test, and primality is a second test. In the original idea with a=1, b=2, if the word is a palindrome in letters, the number form might not be (zz -> 2525), so that's two different palindrome tests and a primality test which "deified" passes. (Incidentally: if the digits don't need to being a palindrome, then: "Live not on evil, Madam, live not on evil" is prime).

                This has been a mishmash of PowerShell which has convenient string/char code handling, SWI Prolog which has implicit bignums and a builtin fast probabalistic prime test with bignum support in "crypto_is_prime/2"; Dyalog APL which has excellent base conversion: 26⊥⎕A⍳'WORD'. Each language doesn't have the other things: C#/PowerShell/APL/Python have no builtin fast bignum-supporting prime test, Prolog has awkward or tedious file/string handling, APL has no bignums or prime test.

  • By stevelosh 2025-01-2120:172 reply

    If you were around in the 80's and 90's you might have already memorized the prime 8675309 (https://en.wikipedia.org/wiki/867-5309/Jenny). It's also a twin prime, so you can add 2 to get another prime (8675311).

    • By nlh 2025-01-224:112 reply

      My other favorite fun fact about this number (other than this new prime info which I am excited to have learned) is that in almost every store I’ve tried it, someone has used that (along with a local area code) as the phone number for a store loyalty card.

      I’m a Bay Area guy, so if you’re ever at Safeway and need to get the discount without giving up your personal info, 415-867-5309 has got ya covered ;)

      • By pwg 2025-01-2215:011 reply

        > someone has used that (along with a local area code) as the phone number for a store loyalty card.

        Usually because for far too long, noisy retailers wanted a "phone number" upon checkout (even if one was paying cash -- Radio Shack was an especially bad one back in the day). For those who didn't want to get yet more telemarketing calls, repeating "Jenny's number" [1] from the song was a way to "just buy" whatever it was you wanted. The minimum wage cashier didn't care, but the cash register demanded "a number". So giving the cashier Jenny's number worked.

        This has largely faded now that they can track everyone via one's credit card numbers.

        [1] https://en.wikipedia.org/wiki/867-5309/Jenny

        • By noahjk 2025-01-2215:223 reply

          Does contactless payment help at all? I know it uses a different card number, but I’m not sure if it’s a rotating number.

          • By hakfoo 2025-01-235:11

            There's a conceptually linked concept called the PAR (Payment Account Reference) which some payment systems return.

            You can't transact with it directly, but theoretically it refers to the same payment instrument whether you accessed it by the 16-digit PAN on the card, a mobile wallet that generates a new dPAN each time, or a token that corresponds to a secure vault platform.

            It's useful for things like transit payments where someone might tap their card when entering the train and their phone when exiting, and they need to treat them as equivalent for "fares for a single traveller/card can be no more than $x per day"

          • By pwg 2025-01-2217:38

            If a given retailer gets the same number off your card each time you do contactless, then that retailer /could/ track you via that number.

            If all retailers get the same number, then they can each track you, and correlate your purchases between themselves.

            Note, there just needs to be /some/ constant number from whatever comes through via contactless, the number does not have to be the magic numbers that post the sale to the card.

          • By Dylan16807 2025-01-2218:23

            It doesn't rotate. Also it looks like if you use the contactless method built into the actual card it doesn't use a different number.

      • By fancy_pantser 2025-01-228:30

        You can use the number with your local area code just about anywhere at the pump to get a gas discount as well (a common loyalty reward program benefit).

    • By jedberg 2025-01-221:271 reply

      I was around in the 80s, but this is awesome new information!

      • By out-of-ideas 2025-01-223:001 reply

        lol i didnt realize this was a prime number but i re-use this number any time i need a fake phone number in some sample/example data (im pretty certain nobody gets the reference, or takes the time to read it)

        • By freedomben 2025-01-227:48

          I do the same thing! Downside is every time I read my tests I get that song stuck in my head. Upside is it's a joy for some people when they discover it in the test

  • By lehi 2025-01-2116:304 reply

    https://en.wikipedia.org/wiki/Belphegor%27s_prime

    "666" with 13 0's on either side and 1's on the ends.

    • By fuzzythinker 2025-01-2117:511 reply

      "on both sides" because "on either side" to me meant it may be duo of 1-13zeros-6661 and 1666-13zeros-1.

      More for those who don't click the link, other Belphegor primes numbers are with the following number of zeros in both ends (and 1 to cap off the ends): 0, 13, 42, 506, 608, 2472, 2623, maybe more.

      • By sdwr 2025-01-2118:162 reply

        "to either side" or "on either side" commonly means "on both sides"

        "Either" has two meanings:

        - verb-wise, it separates different options (you can have either X or Y)

        - noun-wise, it refers to two similar groups (there was no light on either side of the bridge, or, conversely, the bridge was lit on either side)

        • By quuxplusone 2025-01-2121:30

          Indeed. "On either side the river lie / Long fields of barley and of rye" —Tennyson

        • By jjtheblunt 2025-01-2118:48

          (Native speaker) i read either in the sense of logical or, so one side alone (tegardless of which side) or both sides at once.

          Interesting how varied the ohrasing can be read, though!

    • By TeMPOraL 2025-01-2119:285 reply

      > Belphegor (or Baal Peor, Hebrew: בַּעַל-פְּעוֹר baʿal-pəʿōr – “Lord of the Gap”) is, in the Abrahamic religions, a demon associated with one of the seven deadly sins. According to religious tradition, he helps people make discoveries. He seduces people by proposing incredible inventions that will make them rich.

      Huh. Would feel right at home in our industry.

      > According to some demonologists from the 17th century, his powers are strongest in April.

      Any demo days or other significant VC stuff happening in April?

      > The German bishop and witch hunter, Peter Binsfeld (ca. 1540–ca.1600) wrote that Belphegor tempts through laziness. According to Binsfeld's Classification of Demons, Belphegor is the main demon of the deadly sin known as sloth in the Christian tradition. The anonymous author of the Lollard tract The Lanterne of Light, however, believed Belphegor to embody the sin of gluttony rather than sloth.

      Yeah, hits too close to home.

      Via https://en.wikipedia.org/wiki/Belphegor

      • By irrational 2025-01-220:061 reply

        Can’t spell “demon” without “demo”. Cue the church lady.

        • By alphan0n 2025-01-2221:51

          Startup > trapt (archaic) us

      • By WorldMaker 2025-01-2120:32

        > Any demo days or other significant VC stuff happening in April?

        Lots of tech companies plan elaborate demos for April 1st, for some foolish reason. It certainly gets very busy on HN keeping up.

      • By miki123211 2025-01-2121:191 reply

        How was this never mentioned in Unsong? Not a single time?

        • By TeMPOraL 2025-01-2121:27

          IDK, I guess Scott Alexander didn't do his research thoroughly enough. Still, UNSONG is already pretty much a fractal of references and callouts to such things.

          On that note, how is it I've never seen anyone connecting the famous "God of the gaps"[0] with a demon literally named "Lord of the Gap"?

          (In case no one really did, let history and search engines mark this comment as the first.)

          --

          [0] - https://en.wikipedia.org/wiki/God_of_the_gaps

      • By gpderetta 2025-01-2121:36

        Makes sense, with laziness being one of the three virtues of a great programmer.

      • By vdjskshi 2025-01-2121:16

        Sounds like the patron saint of LLMs

    • By idiotsecant 2025-01-2117:021 reply

      It also works with no zeros, or all sorts of other number of zeros. Dude basically just added zeros until the number got cooler.

    • By yapyap 2025-01-2117:021 reply

      wow, evil pi.

      very interesting, thanks for sharing.

HackerNews