I wrote a code to check the Boston number.
It matches most of the test cases but fails for one of the test cases and the TLE error for another.
Also, the question contradicts its statement.
It states: A Boston number is a composite number, the sum of whose digits is the sum of the digits of its prime factors obtained as a result of prime factorization (excluding 1 ). The first few such numbers are 4,22 ,27 ,58 ,85 ,94 and 121 .
For example, 378 = 2 × 3 × 3 × 3 × 7 is a Boston number since 3 + 7 + 8 = 2 + 3 + 3 + 3 + 7. Write a program to check whether a given integer is a Boston number.
But if you look at 58,85,94,121, you realize that sum of digits is not equal to the sum of their prime factors. So how are they Boston numbers?
Example:
58
sum of digits=5+8=13
prime factors=2,29
sum of prime factors=2+29=31
85
sum of digits=8+5=13
prime factors=5,17
sum of prime factors=5+17=21
Kindly help me understand the problem and the faults in the code.
Thank you.