Add year range speedup

This speeds up our calculations involving counting the days over a
number of consecutive years. This is especially true of large
prehistoric or futuristic dates.

It's arguable that the new function should not be inclusive of the
end year, in a similar way to the Python range function.

@matthewrmshin, please review.