Issue with the test cases

please check this code, this code is working fine except it’s not satisfying two cases. Here is the link for code:

Hi @priyanshu180901_fb9ce5685f941d19,

According to the problem,
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

So, if the number is 26 = 2 x 13
Then, you need to add 2 + 1 + 3 and not 2 + 13.

total+= i;
change above line to
total+= sum(i);

Where sum function is defined as,

int sum(int n){
    int ans = 0;
    while(n){
        ans += n%10;
        n /= 10;
    }
    return ans;
}

Second error is Boston number is a composite number. So prime numbers are not Boston numbers ( 5, 13, 7, …etc)

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.

Thank you, for helping me with this problem and sorry for replying late.

1 Like

Hi @priyanshu180901_fb9ce5685f941d19,

In your latest submission, you ignored this error.