#P10117. Multiplicative Function Chain Summation

    ID: 12103 Type: Default 1000ms 256MiB

Multiplicative Function Chain Summation

Multiplicative Function Chain Summation

Define a multiplicative function \(f(n)=(\mu\ast \operatorname{Id_2})(n)\), where \(\mu\) is the Möbius function and \(\operatorname{Id_2}(n)=n^2\). In other words,

\[ f(n)=\sum_{d\mid n}\mu(d)\Bigl(\frac{n}{d}\Bigr)^2. \]

Given two positive integers n and k, you are required to compute

[ S(n,k)=\sum_{i_1\mid n}\sum_{i_2\mid i_1}\cdots\sum_{i_k\mid i_{k-1}} f(i_k), i_1, i_k, \mu^2\Bigl(\frac{i_1}{i_k}\Bigr), ]

where \(\mu^2(x)\) is 1 if \(x\) is square-free and 0 otherwise. Note that the chain of divisors satisfies \(i_k \mid i_{k-1} \mid \cdots \mid i_1 \mid n\). The factor \(\mu^2\bigl(\frac{i_1}{i_k}\bigr)\) ensures that we only consider those pairs \((i_1,i_k)\) with a square-free ratio.

Your task is to output the value of \(S(n,k)\).

inputFormat

The input consists of two space‐separated integers: n and k.

outputFormat

Output a single integer, the result of the summation (S(n,k)).

sample

6 1
949