Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
great
nice
that is awesome
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?
I am puzzled for this answer. can you give a link or something to explain this algorithm? thank you very much
why is it can compute the result?
what is the algorithm?
Thank you very much
great job