second oneFernandez Jose wrote:Thanks for your answer. Sorry I got mixed up with the inputs. I add two more for cheking a possible overflow, they are:

INPUT:

1000000000

10000000001

OUTPUT:

400000000

1600000000

9897840000

10000000001 = 101 x 3541 x 27961

Actually, the problem describes that n <= 1000000000,

so it will not have the second case 10000000001

but I think maybe your prime checker is something wrong with the bignum.