Hi Eido. Welcome to The Ranch!

The problem is that you aren't resetting the variables each time you go round the loop. In particular sum (the others don't matter, although there's no need to declare them where you do). So what you end up doing is calculating the sum of the factors of all the numbers up to 100.

Fix that, and it

should work. If you're interested, though, that's not a very good algorithm. For a start you don't need to try dividing every number up to

`i` into

`i` - you can stop at

`sqrt(i)`. But if you want a much better way of finding all the primes up to a given number, try searching for the "Sieve of Eratosthenes".