Sum of Number of Divisors of Product

AtCoder
IDarc182_c
Time3000ms
Memory256MB
Difficulty
An integer sequence of length between $1$ and $N$, inclusive, where each element is between $1$ and $M$, inclusive, is called a **good sequence**. The **score** of a good sequence is defined as the number of positive divisors of $X$, where $X$ is the product of the elements in the sequence. There are $\displaystyle \sum_{k=1}^{N}M^k$ good sequences. Find the sum of the scores of all those sequences modulo $998244353$. ## Constraints * $1 \leq N \leq 10^{18}$ * $1 \leq M \leq 16$ * All input values are integers. ## Input The input is given from Standard Input in the following format: $N$ $M$ [samples]
Samples
Input #1
1 7
Output #1
16

There are seven good sequences: $(1),(2),(3),(4),(5),(6),(7)$. Their scores are $1,2,2,3,2,4,2$, respectively, so the answer is $1+2+2+3+2+4+2=16$.
Input #2
3 11
Output #2
16095

For example, $(8,11)$ and $(1,8,2)$ are good sequences. Here is the process of calculating their scores:

*   The product of the elements in $(8,11)$ is $8 \times 11 = 88$. $88$ has eight positive divisors: $1,2,4,8,11,22,44,88$, so the score of $(8,11)$ is $8$.
*   The product of the elements in $(1,8,2)$ is $1 \times 8 \times 2 = 16$. $16$ has five positive divisors: $1,2,4,8,16$, so the score of $(1,8,2)$ is $5$.
Input #3
81131 14
Output #3
182955659

Remember to take the result modulo $998244353$.
API Response (JSON)
{
  "problem": {
    "name": "Sum of Number of Divisors of Product",
    "description": {
      "content": "An integer sequence of length between $1$ and $N$, inclusive, where each element is between $1$ and $M$, inclusive, is called a **good sequence**. The **score** of a good sequence is defined as the nu",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 3000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc182_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "An integer sequence of length between $1$ and $N$, inclusive, where each element is between $1$ and $M$, inclusive, is called a **good sequence**.\nThe **score** of a good sequence is defined as the nu...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments