37
12
The number 113
is the first prime whose length 3
is prime, digital sum 5 = 1 + 1 + 3
is prime, and digital product 3 = 1 * 1 * 3
is prime.
A prime that has these 3 properties will be called supremely prime. The primes 11117
and 1111151
are other examples.
Goal
Write a program that can find the largest supremely prime number possible in less than an hour on a decent modern personal computer (such as the preferred spec here).
You should not simply give us a large supreme prime. You need to show us your search process with code that actually works. You can build on your or other people's solutions but be sure to give them credit. We're kind of communally trying to find the largest supreme prime realizable on a normal computer in an hour.
Scoring
The submission that finds the largest supreme prime wins. If it turns out that there are finitely many supreme primes then the first submission that generates the highest supreme prime wins.
(If you can mathematically prove that either there are or aren't infinitely many supreme primes I'll give you 200 bounty rep just because. :) )
Details
- You may use any source to generate your primes (e.g. internet).
- You may use probabilistic prime testing methods.
- Everything is in base 10.
- Zero and one are NOT considered prime.
- Primes that contain
0
have a digital product of0
so obviously they can't be supreme. To keep the page less cluttered put large (100+ digit) supreme primes in the form:
{[number of 1's before the prime digit]}[prime digit]{[number of 1's after the prime digit]}
So
1111151
could be expressed as{5}5{1}
.
Can we start with a list of primes, or fetch a list from the internet, and spend the hour doing supremeness checks? – Sparr – 2014-07-31T04:07:27.743
@Sparr Yes, you can get your primes from anywhere. – Calvin's Hobbies – 2014-07-31T04:09:15.767
Can we start with the largest known supreme prime? Personally, that would allow a lazy person to benefit from the machine hours of others. That said, do we have to check all primes from 2 upwards? – DavidC – 2014-07-31T04:09:38.420
@DavidCarraher That's true but I think I will allow starting at the highest known supreme prime. Presumably the person who generated it will already have tried to look higher. – Calvin's Hobbies – 2014-07-31T04:16:31.777
2If you can start with the highest known supreme prime then this becomes a challenge for who can write a program that spends exactly an hour spanning the largest possible gap between two supreme primes. :( – Sparr – 2014-07-31T04:24:20.187
@Sparr Maybe but I'm not sure how else to structure it. Forcing searching one at a time from 2 would not get very far since vast ranges (e.g. 10^8 to 10^10) are clearly not supreme. This way the people with the better searching algorithms should rise to the top. – Calvin's Hobbies – 2014-07-31T04:32:38.103
8Next to not containing a 0, any potential supreme prime must obviously be of the form 1^n[3|5|7]1^m, i.e. some 1s, any prime below 10 and some more 1s. There are more constraints you can put on it right away. – Ingo Bürk – 2014-07-31T04:35:32.163
@Ingo Bürk - There's probably a few dumb tricks in here to eliminate a few tests.
– Kyle McCormick – 2014-07-31T04:55:30.487I'm hard coding a lower limit based on where I've already searched. I can remove that if necessary. – isaacg – 2014-07-31T05:01:03.243
Just to be clear, are we not allowed to skip any primes? E.g., find all supreme primes after in a given range? If so, that should made much more clear, and the challenge rephrased. – isaacg – 2014-07-31T05:29:46.953
@isaacg You can skip primes and have limits. The main point is to optimize how you are searching and show the results. – Calvin's Hobbies – 2014-07-31T05:45:33.470
If you allow to skip primes, it becomes a test of how fast you can test for prime, as you just need to start at any prime number and add a leading 1 to it. The product will be the prime and the sum will be leadingOnes + prime. All thats left is checking for prime. – TwoThe – 2014-07-31T13:27:36.927
3
Ryan has started a related question on MSE as to the existence of infinitely many supreme primes. If you've any insights for that question, please weigh in!
– Semiclassical – 2014-07-31T15:30:26.250@Semiclassical thanks for sharing the link. – Ryan – 2014-07-31T15:42:40.503
I think a proof of the existence of infinite of these supremely primes, hinges on the twin prime conjecture... I highly doubt anyone will be able to form a proof. – Tally – 2014-07-31T23:35:40.517
Isn't the first prime that fits the criteria 11? – nmtoken – 2014-08-01T11:51:46.270
@nmtoken 1*1 = 1 is not prime. – Ingo Bürk – 2014-08-01T12:19:19.937
1
I can easily show that there is not currently a proof of an infinite number of supreme primes (and that a substantial amount of work has gone towards it). According to http://michaelnielsen.org/polymath1/index.php?title=Bounded_gaps_between_primes, we know that primes come along infinitely with gaps as small as 246, but for a proof of infinite supreme primes, we need a gap of 2, 4, or 6 (corresponding to the primes with a 3, 5, or 7 somewhere in them).
– Tim S. – 2014-08-01T15:36:12.480@TimS. I guess it is a coincidence that the gap sizes usable for this challenge happens to be the digits of the smallest proven gap size. – kasperd – 2014-08-02T11:33:17.470