COMPUTER PROBLEMS: DAY 5

advertisement
COMPUTER PROBLEMS:
DAY 5
(1) Generate some large prime numbers using the Rabin-Miller primality test.
You may want to use the code under the link on the website. In this case,
calling generate_prime(b,k) generates a random number b bits in length that
passes the Miller-Rabin test k times. Such a number is prime with probability
greater than 1 − (1/4)k . Note that ten bits are roughly equal to three decimal
digits. What should you choose for k to ensure that your number is prime
with probability better than 99.9%? Generate some large numbers that are
probably prime. How long does it take to generate such a number with 512
bits? With 1024 bits?
(2) Look for Mersenne primes by implementing the Lucas-Lehmer primality test.
You can find out how to run this test either from your class notes or by looking
online. Verify your results by looking up Mersenne primes online.
(3) The repunits base b are integers that consist of repeating ones in the base b
representation. For example, Mersenne numbers consist of repeating ones in
binary representation. In general, the base b repunit of length k has the form
bk − 1
.
b−1
Try to find repunits that are probably prime by modifying the Rabin-Miller
code.
(4) Is the number
1881127702321127617087679512659599640999583
5201431633288129046662122067416818277286993
prime?
(5) Find a prime number with at least 100 decimal digits. Find the next five
primes. How certain are you of your results?
(6) I have encrupted my PIN using f (x) = x7 mod 4159023203. The result is
2034980130. What is my PIN?
Non-computer problems:
(1) Show that ax3 + bx + c is an integer for each integer x if and only if 2a, a + b
and c are integers.
√ √
√
√
(2) Show that if x, y, z and x + y + z are rational then so are x, y and z.
1
Download