Ad
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    The solution is based on python 2, which interprets "/" as integer division. You have to replace "/" by "//" for python 3.

  • Default User Avatar

    Hi! There are a few basic mathematical ingredients in the mix.
    Let's first try to solve the problem of computing the multiples of a single
    number k up to a number n. If k is 1, then we want to sum all numbers between 1 and n.
    This was solved by famous mathematician Gauss when he was around 10, by giving the Gauss sum n*(n+1)/2. What if k > 1? If m = n/k,
    we can write: k + 2k + 3k + ... + mk as k(1+2+3...+m). So we use "m = n/k" instead of "n" in the Gauss sum (however, we have to take care of rounding, therefore the -1 in the solution) and first compute (1+2+...+m) = (m)(m+1)/2. We get the actual sum k+2k+... by multiplying the sum with k again.
    The second tool used is the principle of inclusion / exclusion.
    Are these pointers clarifying the code?

  • Default User Avatar

    Maybe a tiny description of the spoken/shouted/... lambda function's semantics would be nice.