Optimize a Python program to run faster and use less memory.
import math
 
# Slow loop implementation
def slow_loop(num):
    for i in range(int(num)):
        result = math.sqrt(i*i + 1)
    return result
import math
 
# Faster loop implementation
def fast_loop(num):
    result = 1
    for i in range(int(num)):
        result += math.sqrt(i*i + 1)
    return result