#     Compute a list of the Bernoulli numbers B_0, B_2, B_4, ..., B_{2m} 
# In Ada Lovelace's notation these are called B_0, B_1, B_3, ..., B_{2m-1}

def bernoulli(m):
    if m < 0:
        print("m must be a nonnegative integer")
    else:
        b = [1]
        for n in range(1, m + 1):
            b = b + [(2 * n - 1) / (2 * n + 1) / 2]
            a = n
            for k in range(1, n):
                b[n] = b[n] - a * b[k]
                a = a * (2 * (n - k) + 1) / (2 * k + 1) * (n - k) / (k + 1)
        return b
        