def largest_prime_factor(n): # Calculate the largest prime factor of an integer n limit = int(n ** 0.5 + 1) for i in range(limit, 1, -1): if n % i == 0 and is_probable_prime(i): return i
def compute(): ans, k = 0, 0 while (k+1)**3 - k ** 3 < limit: ans += is_probable_prime((k+1)**3 - k ** 3) k += 1 return ans