p31

advertisement
Programming Assignment 31
Twin Primes
91.101 Computing I
Fall 2006
Twin primes are two prime numbers that differ by 2. For example, 3 and 5 are twin
prime numbers, so are 101 and 103. Write a program that prints all twin primes less than
3000. Your program should make use of a function called IsPrime.
Can you?
Convert a decimal number into its 32 bit unsigned binary equivalent?
Convert a decimal number into its 32 bit twos complement equivalent?
Convert a decimal floating point number, say 14.238, into its binary
floating point equivalent?
How do you know that you can? Can you do this at a moment’s notice?
With confidence? Have you tested yourself before I test you?
Download