The mod function returns the remainder of integers division. The last two follow from the quotient remainder theorem. Add to the current date. Thus there are 52 full weeks and 1 day in a year, so we add one to the day of the week to get the day of the week next year. Note that 1 is, by definition, not prime.
Primes are integers which have no non-trivial factors.
It seems like it should get harder and harder for large numbers to be primes, since any prime number less than n is a potential factor. Certainly, prime numbers tend to get rarer and rarer as n gets larger. There are 168 primes less than 1000, but only 135 primes from 1000 to 2000. There are 5133 primes less than 50,000, but only 4459 from 50,000 to 100,000. Euclid's Proof Euclid showed that there are an infinite number of prime numbers using an elegant proof by contradiction .