def euler_097(): mod = 10**10 # we want the last ten digits s = 1 for _ in range(7830457): s = (s * 2) % mod s = (28433 * s) % mod s = s + 1 return s if __name__ == "__main__": solution = euler_097() print("e097.py: " + str(solution)) assert(solution == 8739992577)