Imagine a bag containing cards representing all ndigit odd numbers.
A random card is drawn and two new numbers are created by preceding the drawn number by each of its even neighbors.
What is the probability that each of those 2 numbers is prime?
Examples:
For n=1 there are 5 cards i.e. 1,3,5,7 and 9. Clearly only numbers 3 and 9 qualifiy since fboth 23 and 43 are primes and so are 89 and 109 & there are no other answers.
So for n=1 p=0.4 is the probability we were looking for.
For n=2 I will not provide the answer but will show you one of the qualifying numbers e.g. 69, since both 6869 and 7069 are prime.
Now evaluate the correct probabilities for n=2,3, ...8,9
(or as far as your resources allow)  and you will get a sequence for which you may be credited @ OEIS.
So this time you get a task both challenging and rewarding!
GOOD LUCK...
(In reply to
via computer  the start of the soln by Steven Lord)
Your first three values agree with mine. Thereafter your probabilities go up while mine go down. Going up seems counterintuitive, as primes get rarer as the order of magnitude increases.
I found only 56 occurrences among the 4500 4digit numbers. Your probability of .0376 implies .0376*4500 ~= 169. Perhaps you could modify your program to list the 169 found, to see if I missed some or some of yours involved nonprimes.
Added later:
I'm thinking that if the problem is on your side (too many found), the problem might lie in the primality test:
m=(1.*i)/(1.*j)
While m is defined as an integer, the decimal points make the division take place in floating point, or real. As the conversion is implicit, there's no "kind" specification. Perhaps in the division of 8digit or higher numbers, the integer part of the quotient is not actually the true quotient, if only single precision is used.
Edited on July 28, 2019, 11:10 am

Posted by Charlie
on 20190728 07:58:12 