11
$\begingroup$

Today, 20240603 already in some parts of the world, is a prime number. Just twenty-one other dates during 2024 are also primes.

In what year will there be none?

$\endgroup$
3
  • $\begingroup$ math.stackexchange.com/questions/3488712/… suggests the smallest year is the year 27789755 $\endgroup$ Commented Jun 3 at 14:58
  • $\begingroup$ @BeastlyGerbil According to a comment by nickgard at that link, the first nonprime year is actually 13446204. $\endgroup$
    – isaacg
    Commented Jun 3 at 15:50
  • $\begingroup$ ...empirically, there is no solution for the format YYYYMMDD. $\endgroup$ Commented Jun 3 at 16:15

2 Answers 2

12
$\begingroup$

Here is a year when there definitely will be none

$10000!$

Because

For each $2 \leq n \leq 10000$, $10000! + n$ is divisible by $n$.

More importantly, $10000(10000!) + n$ is also divisible by $n$ and so, not prime.

Since $10000(10000!) + 1$ does not constitute a meaningful date, we don't have to worry about that and all other dates will be covered.

A smaller example

Given that we only have to worry about factors less than or equal to $1231$ we can say the same about the year $1231!$

In fact we could consider a year which is just given by the product of all possible MMDD date combinations which is again much smaller.

$\endgroup$
2
  • 2
    $\begingroup$ (And instead of the product we could use the LCM...) $\endgroup$
    – mathmandan
    Commented Jun 4 at 14:52
  • $\begingroup$ @mathmandan Yes, indeed! $\endgroup$
    – hexomino
    Commented Jun 4 at 14:58
0
$\begingroup$

Using the time-honored tactic of hoping my code finishes before the heat-death of the universe, it appears that the first year that meets this criteria is:

8153391

I found this with this rudimentary python script, which prints the year each time a new minimum number of prime dates within the year is found:

This script uses the sympy library, which has a function to return all primes within a given range. Feel free to mock my poor python skills in the comments!


     import sympy

     def is_date(number):
       day_count_for_month = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

day = int(number % 100) number = (number - day) / 100 month = int(number % 100) year = int((number - month) / 100)
if year%4==0 and (year%100 != 0 or year%400==0): day_count_for_month[2] = 29
return (1 <= month and month <= 12 and 1 <= day and day <= day_count_for_month[month])
best = 100 i = 2024 found = False
while not found: primes = filter(is_date,sympy.primerange(10000 * i, 10000*i + 1231)) length = len(list(primes))
if length < best: print(i) print(length) print() best = length
if length == 0: found = True
i = i + 1

I forgot to have the script print timestamps, so I'm not sure exactly how long it took, but it was between 6 and 18 hours.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.