3

Statement of the problem:

The divisors of 6 are 1,2,3 and 6. The sum of the squares of these numbers is:

1 + 4 + 9 + 9 + 36 = 50

Allow sigma2(n) to represent the sum of the squares of the n-dividers.

Thus, sigma2(6) = 50.

And addition_sigma2 (n) is the sum of all sigma2, smaller than or equal to n. For example,

addition_sigma2(6) = 113

This is what I have programmed in Maxima:

sigma2(n) :=
   divsum(n,2)$

addition_sigma2(n) :=
    lreduce("+", makelist(sigma2(k), k, 1, n))$

But, it's very inefficient. Well, I need to calculate addition_sigma2(10^17) and my algorithm is not able to calculate it. Can you think of any improvements?

Adam
  • 1,254
  • 12
  • 25
Programar
  • 31
  • 3
  • `addition_sigma2()`, `sums_sigma2()`, and `sigma2_sums()` are all the same? Looks like so... If so could you please use a single name? If not, then please explain what is which? – Rolazaro Azeveires Mar 07 '18 at 21:36
  • I have just edited @RolazaroAzeveires – Programar Mar 08 '18 at 11:27
  • In my experience, the point of project Euler problems is to solve them yourself. While I certainly don't object to someone giving/receiving help tips and hints, I would hope you aren't looking for a full solution. – nurdyguy Apr 03 '18 at 19:25

0 Answers0