I'm working on implementing the Sieve of Sundaram.
The first step is to get a list of Integer's such that:
i, j are Natural Numbers, 1 <= i <= j
i + j + 2*i*j <= n
Here's my function. It's supposed to generate a list of tuples of all (i, j)
's that match the above
restrictions.
numsToRemove :: Integer -> [(Integer, Integer)]
numsToRemove n = [ (i, j) | i <- [1..n], j <- [1..n], i <= j, i >= 1, j >= 1,
i * j + 2*i*j <= n]
But I'm getting non-primes in my answer. Excluding my other work, I think that I'm making a mistake in generating this list of Integers.
Please let me know what I'm doing wrong.