You are viewing a single comment's thread. Return to all comments →
python solution:
# Write your code here sum_of_digits_of_numbers = (n-1)%9 + 1 prime_factors_sum = 0 while n%2 == 0: n = n//2 prime_factors_sum += 2 for i in range(3,int(math.sqrt(n)) + 1,2): while n % i == 0: prime_factors_sum += i n = n // i if n > 2: prime_factors_sum += n prime_factors_sum = (prime_factors_sum-1)%9 + 1 if sum_of_digits_of_numbers == prime_factors_sum: return 1 else: return 0
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 →
python solution: