Question
A Smith number is a nonprime integer such that the sum of its digits is the sum of the digits in its prime factorization. For
A Smith number is a nonprime integer such that the sum of its digits is the sum of the digits in its prime
factorization. For example,
58 is a Smith number because 58 = 2 * 29 and 5 + 8 = 2 + 2 + 9
See https://en.wikipedia.org/wiki/Smith_number
See also https://oeis.org/A006753
Write a C program that inputs a sequence of integers terminated by 0. For each positive nonprime N
the program reports whether N is a Smith number.
Example program run (updated 1/26 to show treatment of negative and prime inputs)
N: 8
N: 17
N: 4
Yes
N: 10
No
N: 727
No
N: 728
Yes
N: 729
Yes
N: 777
No
N: 4937775
Yes
N: 121
Yes
N: 100
No
N: 1000
No
N: 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started