Здається, є помилка в умові задачі. Наскільки я зрозумів, функція f(n, k) дорівнює сумі чисел від 1 до n, яку ділять на k та беруть залишок. А в умові (i mod k) - взято в дужки, що означає суму остач від ділення кожного з чисел i на k.
Dyadka_Dimka There is no division .
This maybe useful , Let f(n)=\{d : d \mid n\} i.e. is the set of divisors of .
We claim that f(n) \cap f(n+1)=\{\} , This is because \gcd(n,n+1)=1 according to Euclidean Algorithm , which shows that no divisors are common expert trivial , Dividing by isn't affecting the claim because it only affect power of and no consecutive integers can be even.
And thus answer is |f(\frac{n}{2})| \times |f(n+1)| when is even and |f(\frac{n+1}{2})| \times |f(n)| when is odd.