Day 2

Problem 1: Prime Number Iterator

Make an iterator over the prime numbers less than or equal to nn using a Sieve of Eratosthenes

Sieve of Eratosthenes:

Hint: 1:2:10 gives you a range over (1, 3, 5, 7, 9)

Problem 2: Outer Product Matrix

Problem 2: Write a matrix type which is the outer product of two vectors

Problem 3: Peano Arithmetic

Peano arithmetic provides a compact axiomatic description of the natural numbers. An informal description is:

From this we can recursively construct the naturals. Further, we can define addition recursively:

+(0, 0)    = 0
+(x, 0)    = x
+(0, x)    = x
+(x, S(y)) = S(x + y)

As well as multiplication:

*(0, 0)    = 0
*(x, 0)    = 0
*(0, x)    = 0
*(x, S(y)) = x + (x * y)

For your implementation, you'll define types and methods to compute Peano arithmetic.