Question: Write an Elisp program to generate a random number and use the step below to find if it prime number or not. If it can
Write an Elisp program to generate a random number and use the step below to find if it prime number or not. If it can be determined that the number is not prime, then randomly generate another number and try again. Save the results and give the probabiltity whether the number is prime or not.
1. Randomly generate an integer "a".
a = not prime, b = test succeeds
2. P(a) = Probability that any p in a. In a range of 1 - 100,000
3. P(b) = Probabilty that fermat's test succeeds for any p and a in choosen range.
4. P(b|a) = Probabiltiy that test succeeds given that p is NOT PRIME.
5. P(a|b) = Probabilty that p is NOT PRIME given that a test succeeds use Bayes Law
Bayes Law -
6. Record test succeds and fails
7. P(c) = P(a|b) * # of succeesful tests
8. Display test results
Plalb) = Pla), Pa P(bla) (bla P(b) b)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
