Problems & Puzzles: Puzzles

          Puzzle 1213 663264564664543523551

Giorgos Kalogeropoulos sent on March 10, 2025, the following very interesting & challenging puzzle:

P = 663264564664543523551 is the smallest number with the following properties:
a) P is prime
b) Every digit d of the number appears d times in the number
c) It is the sum of the first n prime numbers (in this case n=7377878744)

Q1. Can you find another number having these 3 properties?
Q2. Can you find another number having these 3 properties that has the digits {1,2,3,4,5,6,7} or {1,2,3,4,5,6,7,8}?

I (CR) would like to add a simpler question:

Q3. Send all the integers you can find possesing only the properties a) & b)?


Contributions came from Davide Rotondo, Giorgos Kalogeropoulos, Michael Branicky, Paul Cleary, Gennady Gusev, Simon Cavegn, Oscar Volpatti

 

***

Davide wrote:

https://oeis.org/A078348

***

Giorgos wrote:

Here is my take on the Q3 of the puzzle

There are finitely many such primes but this number is massive to compute.
Here are the first few of them up to 8-digits
3313, 3331, 32233, 32323, 33223, 123323, 132233, 223133, 223313, 223331, 231323, 233231, 312233, 321323, 323123, 
3344443, 3434443, 3443443, 4434343, 4443433, 14334443, 14443343, 14443433, 31434443, 31443443, 33434441, 33555553, 
34144343, 34344341, 34344413, 34413443, 34414343, 34434341, 34443341, 34444331, 35535553, 41443343, 43334441, 
43344143, 43344341, 43434341, 43443341, 44133443, 44143433, 44314343, 44314433, 44334431, 44343413, 44413433, 
44433413, 55355533, 55555333, 77777177
Out of these numbers 32323 and 3443443 are also palindromes

For 9-digits there exist 154 such primes and 1 palindrome prime 324434423
For 10-digits there exist 222 such primes and no palindromic  primes
For 11-digits there exist 471 such primes and 3 palindromic  primes  : 
74747774747, 77474747477, 99929992999
For 12-digits there exist 5446 such primes and no palindromic  primes
For 13-digits there exist 2849 such primes and 5  palindromic  primes  :
3446663666443, 3646643466463, 3664463644663, 3664643464663, 7776667666777
For 14-digits there exist 71486 such primes and no  palindromic  primes  :
For 15-digits there exist 1565851 such primes and 25  palindromic  primes  :
344666232666443, 348848838848843, 362664434466263, 364466232664463, 366642434246663, 366644232446663, 
388844838448883, 726677676776627, 727667676766727, 727766676667727, 766627777726667, 766767272767667, 
767662777266767, 776276676672677, 776672676276677, 777888878888777, 787888777888787, 788778878877887, 
788878777878887, 944992999299449, 949924999429949, 949992494299949, 992499494994299, 999492494294999, 
999942494249999
For 16-digits there exist 529704 such primes and no  palindromic  primes  :
For 17-digits there exist 18520968 such primes and 44  palindromic  primes  :
36866888388866863, 36868688388686863, 36886688388668863, 36888668386688863, 38686868386868683,
74646776767764647, 74667764746776647, 74676746764767647, 76467674747676467, 76467764746776467, 
76474766766747467, 76644776767744667, 76647647774674667, 76664747774746667, 76674647774647667, 
76677464746477667, 76746467776464767, 76746674747664767, 76766447774466767, 76774664746647767, 
76776644744667767, 77474666766647477, 77646467776464677, 77664746764746677, 77667464746476677, 
77674664746647677, 92696699999669629, 92966996969966929, 92969696969696929, 96269969996996269, 
96626999999962669, 96669299999296669, 96669929992996669, 96926969996962969, 96966992929966969, 
96996962926969969, 96999626962699969, 98988899999888989, 98988989998988989, 99299666966699299, 
99669269996296699, 99888899999888899, 99898988988989899, 99929666966692999

These numbers can get up to 45-digits so the number of total primes is gigantic!

 

***

Michael wrote:

Satifying (a) and (b), there are no terms with highest digit d = 1, 2, 4, 8, or 9.

d: smallest term | # of terms
3: 123323 | 10
5: 122334444555553 | 1197011
6: 122334444555566566663 | 1M <= 122435556636646456543
7: 1223334444555556666677767777 | 1M <= 1223334445657765777666476557

later he added:

Q1: There is no number greater than the given P satisfying just (b) and (c) with highest digit 6 (searching sums of first n primes, trying to satisfy (b)).
Q2: There is no prime satisfying (b) with highest digit 8 or 9, since the sum of digits is a multiple of 3.

***

Paul wrote:

Here is my attempt at Q3.  There were starting to be many solutions as the digit length got bigger, at digit length 15 there were over 1.5 million solutions so I stopped there, I have included a txt file of all of the solutions I found. ( it is larger than 25 meg so it had to go as a google drive doc).


However on a side note I took the liberty of shortening the list by only including those solutions that were palindromes, this was more manageable and was able to go upto 17 digit length, here is that list.

3443443
324434423
74747774747
77474747477
99929992999
3446663666443
3646643466463
3664463644663
3664643464663
7776667666777
344666232666443
348848838848843
362664434466263
364466232664463
366642434246663
366644232446663
388844838448883
726677676776627
727667676766727
727766676667727
766627777726667
766767272767667
767662777266767
776276676672677
776672676276677
777888878888777
787888777888787
788778878877887
788878777878887
944992999299449
949924999429949
949992494299949
992499494994299
999492494294999
999942494249999
36866888388866863
36868688388686863
36886688388668863
36888668386688863
38686868386868683
74646776767764647
74667764746776647
74676746764767647
76467674747676467
76467764746776467
76474766766747467
76644776767744667
76647647774674667
76664747774746667
76674647774647667
76677464746477667
76746467776464767
76746674747664767
76766447774466767
76774664746647767
76776644744667767
77474666766647477
77646467776464677
77664746764746677
77667464746476677
77674664746647677
92696699999669629
92966996969966929
92969696969696929
96269969996996269
96626999999962669
96669299999296669
96669929992996669
96926969996962969
96966992929966969
96996962926969969
96999626962699969
98988899999888989
98988989998988989
99299666966699299
99669269996296699
99888899999888899
99898988988989899
99929666966692999

***

Gennady wrote:

Q3.I found several hundred such numbers from 3313 to 6366663631.
Here a few:

3313
3331
32233
32323
33223
...
6366163663
6366366163
6366661633
6366663361
6366663631

***

Simon wrote:

Q1
663264564664543523551 prime, sum of first 7377878744 primes (already known)
524455542519939949999933 prime, sum of first 194321151012 primes
742676654767654576752457 prime, sum of first 230506517004 primes
4625564557674621757647677 prime, sum of first 565902904938 primes
7421765574654266554776767 prime, sum of first 713854734012 primes

Q2
Would require about 5-10 weeks of calculating.

Q3
If my permutation algorithm is correct:
There are 391091500800 numbers with 21 digits {1,2,3,4,5,6} each digit d appears d times where the last digit is 1 or 3.
And about 31496400000 of them are prime.
Here 10 of these primes
223345446616456565563
212334654445566566653
223351456664446556653
223354655516646664453
223356416445655665463
212335565664545644663
212343565566564664543
122353466546654654653
223143545666655466453
212363455466664465553

***

Oscar wrote:

Q1
Search strategy.
Use the sieve of Eratosthenes to enumerate primes p in ascending order, updating two counters:
n, the number of primes found;
s, the cumulative sum of all primes found;
for each computed value s, check if properties a) and b) are satisfied too.
I double-checked that the given example is actually the first solution; next solution is:
p = 5498772574957,
n = 194321151012,
s = 524455542519939949999933.
Property a) holds, with apr-cl test passed.
Property b) holds too, with digit set {1,2,3,4,5,9}.

Q2, set {1,2,3,4,5,6,7}
The smallest number satisfying property b) with given digit set is:
smin = 1223334444555556666667777777.
How many primes do we need to sum in order to exceed such value? 
If nth prime grows like n*log(n), then nth prime sum grows like n^2*log(n)/2.
Solving for n, I obtained the estimate nmin = 9055839582146.
A whole week wouldn't suffice to enumerate and sum so many primes on my laptop.
I used programs "primecount" and "primesum" by Kim Walisch to efficiently detect the following twin primes:
p1 = 283152283125917,
n1 = 8781597850334,
s1 = 1223334444555437690123995761 < smin;
p2 = 283152283125919,
n2 = 8781597850335,
s2 = 1223334444555720842407121680 > smin;
Then I used the sieve of Eratosthenes to enumerate only primes p>p2, until I found a solution:
p = 287725995408461,
n = 8919008326434,
s = 1262556747547367564356776347.

Q2, set {1,2,3,4,5,6,7,8}
There are no solutions. 
If number x satisfies property b) with such digit set, then its digit sum is:
1*1+2*2+...+8*8 = 204 = 3*68 
Therefore prime 3 divides x too and property a) fails.

Q3
Let's call a digit set D admissible if it satisfies the following properties:
it doesn't contain digit zero; 
it contains at least two elements;
at least one of its elements is coprime with 10;
the sum of the squares of its elements is coprime with 3.
Motivation: if number x satisfies property b) with a non-admissible digit set D, then x can't be prime.
Among the 2^10 = 1024 possible digit sets, 712 sets are non-admissible.
No prime satisfies property b) for admissible sets {1,2}, {1,4}, {1,5}, {1,6}, and {1,8}.
For each of the remaining 307 admissible sets, at least two primes satisfy property b); 
attached file P1213OV.txt provides the first and the last such primes per set.
First solution at all:
x = 3313,
D = {1,3}.
Last solution at all:
x = 99999999988888888777777766666655555444223343,
D = {2,3,4,5,6,7,8,9}

 

***

 

 

Records   |  Conjectures  |  Problems  |  Puzzles