2

Is $4\underbrace{999 . . . 9}_{224 ({\rm times})}$ prime?

I wanted to find smallest prime its sum of digits is $2020$. I started with small primes; the smallest three digits prime its sum of digits is 22 is $499$; four digits is $4999$ with sum of digits 31, five digit is $49999$ with sum of 40.For the sum $2020$ we have:

$2020=224\times 9+4$ and desired number can be of the form $4\underbrace{999 . . . 9}_{224 ({\rm times})}$ . So this number has at least 225 digits. If it is not prime we have to search for numbers with number of digits more than 225 which of course have digits less than 9 and first digit probably less than 4. I could not check it with my computer. I have these questions:

1- is $4\underbrace{999 . . . 9}_{224 ({\rm times})}$ primes?

2- are numbers of the form $499 . . . 99$ always primes? If so what is theoretical reason? If not what is conditions for it to be prime?

Update: the closed form of these numbers is $N=5\times 10^n-1=5(10^n-1)+ 4$, $n ≥ 2$ if n is even we have:

$10^{2k}-1=(10^k-1)(10^k+1)$

Since $[10^n-1, 5, 4]=1$ N can be a prime, but brute force gives a counter result. If n is odd N can be composite.

Shaun
  • 44,997
sirous
  • 10,751
  • 1
    $49$ is not prime – J. W. Tanner Mar 13 '20 at 17:09
  • 49...9? What about good ol' 7X7 as an answer for 2? –  Mar 13 '20 at 17:11
  • @J.W.Tanner i think you misunderstood the question (although it's pretty clear). – Quang Hoang Mar 13 '20 at 17:13
  • To answer question #2, where the number of 9s is arbitrarily large, I don't see why there would be a known answer to that--isn't generating arbitrarily large primes an open question? – Mike Mar 13 '20 at 18:02
  • The sequence $a(n)=\text{A067180}$ is available in OEIS and collects smallest primes whose digit sum is $n$. Sadly, it goes up to $n=175$ only, so such smallest prime for $n=2020$ is not available there (at the moment).

    However, if you instead would satisfy yourself with the smallest prime whose sum of digits in binary is equal to $2020$, then the solution would be the prime number $2^{2021}-2^{1359}-1$, having $609$ (decimal) digits, according to sequence $b(n)=\text{A061712}$ which is available in OEIS.

    – Vepir Mar 13 '20 at 19:50
  • It's partial factorization is $$4259 \cdot 36418777663409\cdot 851656886812221489761650074771849972581 \cdot C_{169}$$ with a composite $169$-digit factor (not yet factorized), see https://stdkmd.net/nrr/4/49999.htm, and in particular https://stdkmd.net/nrr/c.cgi?q=49999_224. – Sil Mar 13 '20 at 20:30
  • One could thought the most of the numbers in this series is composite. For example for $n=7,8,9,10,11,12,13$ we have $7$ consecutives which are composite. – Piquito Mar 13 '20 at 20:42
  • You can work with such numbers easily using Pari/GP. I tried px=(5*10^224-1);ispseudoprime(px) and got the result 0 which means not which means : already pseudoprime-test gives compositeness. You can get Pari/GP from University Bordeaux to play a bit with number theory. – Gottfried Helms Mar 17 '20 at 18:18

3 Answers3

7

Answering the implicit question: what is the smallest prime with digit sum $2020$?

$\color{blue}{5}999999999999999999999999$
$9999999999999999999999999$
$999999999\color{blue}{8}999999999999999$
$9999999999999999999999999$
$9999999999999999999999999$
$9999999999999999999999999$
$9999999999999999999999999$
$9999999999999999999999999$
$9999999999999999999999999$ is prime.

Alternative form: $10^{225}-4\cdot10^{224}-10^{165}-1$

This is a single decimal number of $225$ digits written across $9$ lines of $25$ digits each. All digits are $9$ except for the initial $5$ and a single $8$ in the third line, so its digit sum is: $$225\cdot9-5=2020.$$

This is the highest placement of the $8$ that yields a prime number, so this is the smallest prime number with digit sum $2020$.


Edit: to explain the methodology in response to comments.

$224\cdot9<2020$ so we know that we need at least $225$ digits. We can start from $10^{225}-1$, which is $225$ nines, and we need to reduce the total digit sum by exactly $5$, reducing leading digits in preference to later digits and checking whether each number is prime.

The first number to check is $\color{blue}{4}999999\dots\;$ but we know this is not prime.

Next, check
$\color{blue}{58}99999\dots$
$\color{blue}{5}9\color{blue}{8}9999\dots$
$\color{blue}{5}99\color{blue}{8}999\dots$
$\color{blue}{5}999\color{blue}{8}99\dots$

and so on. Then, if needed, check
$\color{blue}{67}99999\dots$
$\color{blue}{688}9999\dots$
$\color{blue}{68}9\color{blue}{8}999\dots$
$\color{blue}{68}99\color{blue}{8}99\dots$

It turns out that the first prime found is the number given above. The number is equivalent to reducing the digit representing $10^{224}$ by $4$ and the digit representing $10^{165}$ by $1$. This gives us the alternative form of the number.

nickgard
  • 4,116
  • @nikgard, great job, how did you find the formula? Did you first find it by brute force and then formulated it? – sirous Mar 15 '20 at 17:12
  • How do you know whether $10^{225}-4\cdot10^{224}-10^k-1$ is a prime for $k=165$ and not a prime for $165 < k \leq 224$)? – Wolfgang Kais Mar 18 '20 at 11:52
  • @WolfgangKais All of those numbers were checked and found to be composite. I've added an edit to explain the methodology. – nickgard Mar 18 '20 at 15:37
  • @nickgard Thanks, but that explains the sequence of numbers chosen for testing, which I already understood, I believe, that when these numbers are composite, that someone might have found a divisor already, but how about the case $k=165$? Who proved that the resulting number is a prime (and HOW)? – Wolfgang Kais Mar 19 '20 at 01:14
  • @WolfgangKais There are plenty of mathematics packages available that can test primality. It's not necessary to find a divisor. I mostly use Sagemath (which in turn uses PARI/GP prime testing). Other possibilities are Maple, Mathematica, PFGW (which is specifically written for prime testing) and the GMP library for C programming. – nickgard Mar 19 '20 at 05:20
6

A computer search finds $4259\mid 5\times10^{224}-1$. I know of no elegant proof of this, just brute force.

Shaun
  • 44,997
J.G.
  • 115,835
  • could you fix your latex? – L F Mar 13 '20 at 17:22
  • @LuisFelipe I don't see an issue; could you explain what needs fixing. – J.G. Mar 13 '20 at 17:23
  • for a strange reason,mathjax didnt render the latex for me :O – L F Mar 13 '20 at 17:25
  • 1
    @LuisFelipe Ah. That happened to me on another SE page once, so I had to switch from my phone to my laptop to read it. – J.G. Mar 13 '20 at 17:29
  • Then what is smallest prime its sum of digits is 2020? – sirous Mar 13 '20 at 17:47
  • 1
    @sirous That question probably can't be easily answered with present day theory. – J.G. Mar 13 '20 at 17:53
  • @J.G. Powerful enough hardware should be able to preform the search in reasonable time? - Smallest prime whose base $2$ digit sum sums to $2020$ has $609$ (decimal) digits, see OEIS Sequence A061712: https://oeis.org/A061712, which covers all sums up to $3320$. For base $10$ (which is the OPs question), see OEIS Sequence A067180: https://oeis.org/A067180. But sadly the latter goes up to $175$ only. We just need to wait for someone with enough computing resources to extend the base $10$ problem to $2020$, similarly as base $2$ problem was extended beyond $2020$. – Vepir Mar 13 '20 at 19:28
-1

is prime the form $N=5 \times 10^n-1$ is not prime if $n \neq1,7,13,19,25,...,n-1 \neq 6b$