Optimize a given Python program for speed, memory usage and readability.
def factorial(n):
    f =1
    for i in range(2,n+1):
        f *=i
    return f
def factorial(n):
    result = 1
    for i in range(2, n+1):
        result *= i
    return result