Boston Number Question

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.

I have understood the question now, the explanation in the question was not detailed enough however with my new code I’m still facing TLE for test case 2

Here is the updated code: https://onlinegdb.com/PxNZQdxd2

hi @sk_faizan_nasir,
here u need to find the number whose sum of digits are equal to sum of digits of its factor except 1

check here for implementation ive commented the code : https://ide.codingblocks.com/s/656874

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

As i said earlier that i have understood the question and done the implementation as well which is working with all the test cases except one test case that show TLE. I want you to help me optimize my code without STL since STL is further down in the course and this question belongs to functions. Here is my code: https://www.onlinegdb.com/PxNZQdxd2

I have optimized it thanks for your help!

I was cheating on my husband of 18 years with his own friend and after 2 years, my husband caught me. How can I make this go away from his mind and have him forgive me and move forward? I begged him with everything, I made promises but he refused. I explained my problem to my friend and she suggested that I should rather contact a spell caster that could help me cast a love spell to make him forgive me and need me back in his life again, I had no choice than to try it. I messaged the spell caster called Dr Mahlangu , and he assured me there was no problem and that everything will be fine before 28 hours. He cast the spell and surprisingly 28 hours later my husband called me. I was so surprised, I answered the call and all he said was that he have forgive me for everything that had happened He wanted me to return to him. He also said he loved me so much. I was so happy and went to him that was how we started living together happily again.thanks to Dr . if you are here and your Lover is turning you down, or your husband moved to another woman, do not cry anymore, contact Dr. for help now…Here his contact… WhatsApp him at: +27787390989
Email; [email protected]