Problem 372
Pencils of rays

Let R(M, N) be the number of lattice points (x, y) which satisfy M<x≤N, M<y≤N and is odd.
We can verify that R(0, 100) = 3019 and R(100, 10000) = 29750422.
Find R(2·106, 109).

Note: represents the floor function.

These problems are part of Project Euler and are licensed under CC BY-NC-SA 2.0 UK