Imagine a bag containing cards representing all n-digit 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?
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!
(Program was corrected for bug noticed by Charlie.)
To get more would require downloading a many Gbyte file of known primes, which seems (sorry - no insult intended) like a bit of a fool's errand...
do i = 1,13
do j = b1,b2,2
if(l.eq.i)go to 1
Edited on July 30, 2019, 5:03 pm