def sum_of_even_nums(n):
    """Solution to exercise R-3.6.

    What is the sum of all the even numbers from 0 to 2n, for any positive
    integer n?

    --------------------------------------------------------------------------
    Solution:
    --------------------------------------------------------------------------
    We know from Proposition 3.3 that for any integer n >= 1, the sum of the
    first n integers is n * (n + 1) / 2.

    However, because only even numbers are being summed, this is an arithmetic
    progression with a common difference of 2.  The sum of a finite arithmetic
    progression is given by:

    n * (a_1 + a_n) / 2     Where a_1 is the first term and a_n is the nth term

    If we are summing the first 2n even numbers, then n is the number of even
    terms, a_1 is 2, and a_n is 2n.  Therefore the solution is:

    n * (2 + 2*n) / 2
    """
    return n * (2 + 2*n) / 2