19 is a prime number with an interesting property. If you put a 1, 3, 7, or 9 at the end, then you will get 4 more primes. 191, 193, 197, and 199 are all prime. What is the next number p>19 such that p, p1, p3, p7, p9 are all prime?
The next such after 19 is 6949:
for i=1:10000
p=nthprime(i);
good=true;
for j=[1,3,7,9]
p2=p*10+j;
if ~isprime(p2)
good=false;
break
end
end
if good
disp(p)
end
end
finds
19
6949
10111
15727
20149
24799
26041
26881
29587
29947
40213
41203
44257
46747
47701
49057
50023
51061
55921
66109
66643
73939
76819
79579
95947
|
Posted by Charlie
on 2025-05-11 08:54:34 |