Search code examples
cmathmathematical-optimization

Finding abundant numbers from 1 to 10 million using a sum


My task is to implement algorithm in C of finding abundant numbers from 1 to 10 million. Therefore I don't really understand mathematics.

There is several ways how to do it, but efficient and fast (for that BIG input 10 mil) might be by summing - NOT dividing, NOT multiplying, NOT EVEN using remainder after the division. Just sum.

But I'm really confused WHAT to sum. Please guys help, appreciate every single answer.

Only I know is that there are 2476736 abundant numbers under 10 million, common computer hardware is not able to check it even in hours, so I need more efficient algorithm and I know it's able to run under a second.


Solution

  • you could try this by counting all the multiples of an abundant number upto 10 million suppose 12 is the first abundant number you found then 24 would definetly be abundant hence you can count all the multiples of 12 upto the limit you wish then go for the next number.I don't know how fast or efficient it would be.