Perfect Number Problem

13200716 I wrote a program for the perfect numbers problem which works by basically checking whether the number is equal to the 4 possible perfect numbers which are 6,28,8128 and 496 which works with all the examples I have tested it with but when I submit it tells me that its wrong.why?

1 Like

Can you please define what are perfect numbers? Also, how can you consider that there are only 4 perfect numbers?

A perfect number is a number that is equal to the sum of its factors.There are many perfect no.s but there are only 4 perfect no.s which fit under the constraints given in the problem I am solving which is problem:INTRN006

There can also be more perfect numbers between 1 to 10^8

there are only 5 perfect numbers which have less than 9 digits

you can optimize for even numbers

you can optimize for even numbers

but the simplest method would be to make an array of the perfect numbers (due to their scarcity) and using a for loop, check them with if statements.this is what yajat(and I) have done and tested but it says wrong answer!!!

but the simplest method would be to make an array of the perfect numbers (due to their scarcity) and using a for loop, check them with if statements.this is what yajat(and I) have done and tested but it says wrong answer!!!

you have missed the perfect number 33550336

//