> For the complete documentation index, see [llms.txt](https://chenyangwang.gitbook.io/mathematical-base-for-information-safety/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chenyangwang.gitbook.io/mathematical-base-for-information-safety/di-yi-zhang-zheng-shu-de-ke-chu-xing/xian-xing-diu-fan-tu-fang-cheng.md).

# 线性丢番图方程

$$ax+by=c$$

> * **STEP1: 判断有解**
>
>   若$$(a,b)\mid c$$，则有解
> * **STEP2: 求一个解**
>
>   贝祖等式得到$$s$$和$$t$$，则$$x\_0=\frac{c}{(a,b)}s, y\_0=\frac{c}{(a,b)}t$$
> * **STEP3: 求所有解**
>
>   $$x=x\_0+\frac{b}{(a,b)}n, y=y\_0-\frac{a}{(a,b)}n$$
