Puzzle 1291. The last prime before 10^k
N.B. by CR: This puzzle is a way of announcing
my fourth calculator,
PrimeCount Calculator, and of inviting you to use it within its possibilities. But
you may use any other tool to answer the questions, as long as you mention
that tool.
***
Two computations with the
PrimeCount Calculator
are enough to find the largest prime below any x up to 9.2 × 10^18: first
compute π(x), then compute the π(x)-th prime. Since π(x) counts the primes
up to x, the π(x)-th prime is the last of them. For example, π(100) = 25 and
p(25) = 97.
This is what we get for x = 10^k:
| k |
π(10^k) |
largest prime < 10^k |
= 10^k − d |
| 1 |
4 |
7 |
10^1 − 3 |
| 2 |
25 |
97 |
10^2 − 3 |
| 3 |
168 |
997 |
10^3 − 3 |
| 4 |
1229 |
9973 |
10^4 − 27 |
| 5 |
9592 |
99991 |
10^5 − 9 |
| 6 |
78498 |
999983 |
10^6 − 17 |
| 7 |
664579 |
9999991 |
10^7 − 9 |
| 8 |
5761455 |
99999989 |
10^8 − 11 |
| 9 |
50847534 |
999999937 |
10^9 − 63 |
| 10 |
455052511 |
9999999967 |
10^10 − 33 |
| 11 |
4118054813 |
99999999977 |
10^11 − 23 |
| 12 |
37607912018 |
999999999989 |
10^12 − 11 |
| 13 |
346065536839 |
9999999999971 |
10^13 − 29 |
| 14 |
3204941750802 |
99999999999973 |
10^14 − 27 |
| 15 |
29844570422669 |
999999999999989 |
10^15 − 11 |
| 16 |
279238341033925 |
9999999999999937 |
10^16 − 63 |
| 17 |
2623557157654233 |
99999999999999997 |
10^17 − 3 |
| 18 |
24739954287740860 |
999999999999999989 |
10^18 − 11 |
Notice that d = 3 appears for k = 1, 2, 3 and again for k = 17,
d = 11 for k = 8, 12, 15 and 18, and d = 63 for k = 9 and 16.
Questions:
Q1. Reproduce some rows of this table with the PrimeCount
Calculator. How long did k = 18 take on your computer?
Q2. Using p(π(10^k) + 1), find the smallest prime greater than
10^k for k = 1 to 18.
Q3. Beyond the calculator, counting primes is no longer the easy
way: testing 10^k − 1, 10^k − 3, … for primality is much faster. Find d(k)
for k = 19 to 100, or as far as you can.
Q4. What is the largest d(k) you can find, and for which k? For
which other k is d(k) = 3, that is, 10^k − 3 prime?