#P9091. Counting Prefix GCD Sequences

    ID: 22250 Type: Default 1000ms 256MiB

Counting Prefix GCD Sequences

Counting Prefix GCD Sequences

Given two positive integers n and m, consider an integer sequence a of length m where each element ai satisfies ai \in [1,n]. Define another sequence b as the prefix gcd sequence of a, that is,

[ b_1=a_1, \quad b_i=\gcd(a_1, a_2, \dots, a_i) \quad (2 \le i \le m). ]

Note that for any valid b generated in this way, we have bi+1 \mid bi for \(1 \le i .

For given positive integers n and m, define a function \(f(n, m, k)\) as the number of distinct sequences b (constructed as above from some sequence a) in which the number of indices \(i\) (with \(1 \le i < m\)) that satisfy bi = bi+1 is at most \(k\). In other words, if we denote by \(E\) the count of adjacent equal pairs in the sequence b, we require \(E \le k\).

Your task is to compute the following sum modulo \(2^{32}\):

[ S = \sum_{i=1}^{n} ; \sum_{j=1}^{m} ; \sum_{k=0}^{j-1} f\Bigl(\Bigl\lfloor \frac{n}{i}\Bigr\rfloor,; j,; k\Bigr). ]

Note: All formulas must be interpreted in \(\LaTeX\) format.

inputFormat

The input consists of a single line containing two positive integers n and m.

\(1 \le n, m \le \text{(small enough for a DP solution)}\)

outputFormat

Output a single integer, the value of \(S\) modulo \(2^{32}\).

sample

3 2
14