求阶乘

# -*- coding: UTF-8 -*-
"""
求1+2!+3!+...+20!的和。
"""
n = 0
s = 0
t = 1
for n in range(1, 21):
    t *= n
    s += t
print '1! + 2! + 3! + ... + 20! = %d' % s


def _jiecheng_(x):
    a = 1
    for i in range(1, x + 1):
        a = a * i
    return a


a = 0;
for j in range(1, 21):
    a += _jiecheng_(j)

print a