Question
Use Dr.Rackt: If both n and 2 n 1 are primes, then n is said to be a Mersenne prime. The first few Mersenne primes
Use Dr.Rackt:
If both n and 2n 1 are primes, then n is said to be a Mersenne prime. The first few Mersenne primes are 2, 3, 5, 7, 13, 17, 19, 31, and 61. Use the primality routines in SICP 1.2.6 to write a procedure for finding such primes (or use the built in prime?). It should take two parameters the starting n and a predicate to test for primality, and return the next Mersenne prime. (If you find a ten million digit prime number, you can pick up a $100,000 prize and forget all about Lisp; see http://www. mersenne.org/.) An example of calling this function might look like this:
(next-mersenne 20 prime?)
which should return 31.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started