atcoder#ARC154F. [ARC154F] Dice Game
[ARC154F] Dice Game
Score : points
Problem Statement
We have an -sided die where all sides have the same probability to show up. Let us repeat rolling this die until every side has shown up.
For integers such that , find the expected value, modulo , of the -th power of the number of times we roll the die.
Definition of expected value modulo $998244353$
It can be proved that the sought expected values are always rational numbers. Additionally, under the constraints of this problem, when such a value is represented as an irreducible fraction , it can be proved that . Thus, there is a unique integer such that and . Print this .
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines.
The -th line should contain the expected value, modulo , of the -th power of the number of times we roll the die.
3 3
499122182
37
748683574
For , you should find the expected value of the number of times we roll the die, which is .
7 8
449209977
705980975
631316005
119321168
62397541
596241562
584585746
378338599
2023 7
442614988
884066164
757979000
548628857
593993207
780067557
524115712