What is the problem 21 of Project Euler?

What is the problem 21 of Project Euler?

After a few exercises with the focus on other areas, we are in Problem 21 of Project Euler back to focusing on number theory and factorisation. The problem reads Let d (n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).

How to calculate the sum of amicable pairs?

The problem reads Let d (n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d (a) = b and d (b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers.

Is there a correct answer to Project Euler 5020?

Most programs listed in the Project Euler forum would fail to give a correct answer because 5020 can only be found if its complement 5564 is also found and a search limit of 5200 isn’t deep enough to find both.

Is there a limit to the number of amicable numbers?

Evaluate the sum of all the amicable numbers under 10000. This problem’s description can lead to some confusion because we want to add amicable numbers – not amicable pairs – below some limit.

Which is an example of an amicable number?

If d ( a) = b and d ( b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers. For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefore d (220) = 284.

How to calculate the sum of amicable numbers?

Let d (n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d (a) = b and d (b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers. For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefore d (220) = 284.

Are there any amicable numbers under 10, 000?

Let me first show you a list of amicable numbers below 11000 from OEIS A259180: 220, 284, 1184, 1210, 2620, 2924, 5020, 5564, 6232, 6368, 10744, 10856 Well, for 10000 we can easily calculate pairs because both pairs of an amicable set are well below 10000.

How to solve the problem of amicable pairs?

An amicable pair that exceed our search limit is considered suitable. By finding a fast way to sieve the sum of proper divisors we both solve this problem and the somewhat more challenging HackerRank version. We begin by initializing a list, ds [], to all ones, L elements long and fill it by sieving the sum of proper divisors.