Welcome to the Fall 2006 Course Homepage!
Here you can find all the information that you'll need throughout the semester. All announcements will be made on this page so I recommend you monitor it regularly.
Course resources:
Announcements
P = 1 * P.
If a number is not prime then it may be represented as the product of 2 or more prime numbers other than 1.
X = P1 * P2 * ... Pn
Further, at least one of these prime numbers (Pi) is less than or equal to the square root of the subject number:
Pi ≤ sqrt(X)
This is easy to prove by assuming it not to be true then showing the resulting product must be > X.
In our source code example we use the modulo operator '%' to determine whether a number is prime. In one version we compare each candidate to all values between itself and 2. In the other version we just compare candidates to prime numbers less than itself or 216 (whichever is less). So the question is: why do we use 64K (216)? The answer: 64K is equal to the square root of 232. That is, we are guaranteed that the square root of any integer represented by a 32-bit number is less than this value.
Posted: 05-10-2006 17:54 by fredk
gcc -o byteRep byteRep
Last update: 05-12-2006 15:40