You are viewing a single comment's thread. Return to all comments →
def solve(n): sum_digits = sum(map(int, str(n))) prime_factors = [] i = 2 while i <= n: if n % i == 0: prime_factors.append(i) n //= i else: i += 1 sum_factors = 0 for i in prime_factors: sum_factors += sum(map(int, str(i))) return int(sum_digits == sum_factors)
Seems like cookies are disabled on this browser, please enable them to open this website
Identify Smith Numbers
You are viewing a single comment's thread. Return to all comments →