#3474. 乘法逆元

乘法逆元

题目描述

这是一道模板题。

https://oiwiki.org/math/number-theory/inverse/

给定正整数nnpp,求1n1\sim n中的所有数在模pp意义下的乘法逆元。

输入格式

一行两个正整数nnpp

输出格式

nn行,第ii行一个正整数,表示ii在模pp意义下的乘法逆元。

10 13
1
7
9
10
8
11
2
5
3
4

提示

1n3×106 1 \leq n \leq 3 \times 10^6

n<p<20000528,n n < p <20000528,n为质数