$A=\mathbb{Z}\setminus\{ax+by:x,y\in\mathbb{N}\}$

$\max A=ab-a-b$

## 直观理解

$$0\bmod a$$ $$1\bmod a$$ $$2\bmod a$$ $$\dots$$ $$\dots$$ $$\dots$$ $$(a-1)\bmod a$$
$$\xcancel{0b}$$ $$1$$ $$2$$ $$\dots$$ $$\dots$$ $$\dots$$ $$a-1$$
$$\xcancel{0b+a}$$ $$\dots$$
$$\xcancel{\phantom{0b}}$$ $$\xcancel{1b}$$ $$\dots$$
$$\vdots$$ $$\vdots$$
$$\xcancel{\phantom{0b}}$$ $$\xcancel{\phantom{1b}}$$ $$\dots$$ $$\xcancel{2b}$$
$$\vdots$$ $$\vdots$$ $$\vdots$$
$$\xcancel{\phantom{0b}}$$ $$\xcancel{\phantom{0b}}$$ $$\xcancel{\phantom{0b}}$$ $$\xcancel{\phantom{0b}}$$ $$(a-1)b-a$$ $$\xcancel{\phantom{0b}}$$ $$\xcancel{\phantom{0b}}$$
$$\xcancel{\phantom{0b}}$$ $$\xcancel{\phantom{0b}}$$ $$\xcancel{\phantom{0b}}$$ $$\xcancel{\phantom{0b}}$$ $$\xcancel{\phantom{(a-1)b-a}}$$ $$\xcancel{\phantom{0b}}$$ $$\xcancel{\phantom{0b}}$$

## 证明

$\begin{cases} x=-1+bt\\ y=y'-at \end{cases}$

$y'-a<0\implies y'<a$

$a\times(-1)+b(a-1)=ab-a-b$

$$ax_0+by_0=n,~x_0\geqslant 0$$, 则只需证 $$y_0\geqslant 0$$

$$x_0=n\bmod b$$, 则 $$x_0\in[0,b-1]$$, 有

\begin{aligned} by_0&=n-ax_0\\ &\geqslant n-a(b-1)\\ &>ab-a-b-a(b-1)\\ &=-b \end{aligned}

$$b(y_0+1)>0$$, 从而有 $$y_0\geqslant 0$$

## 推广

$A=\mathbb{Z}\setminus\{ax+by:x,y\in\mathbb{N}\}$

$\max A=\operatorname{lcm}\{a,b\}-a-b$

$ax+by=\gcd\{a,b\}\left(x\frac{a}{\gcd\{a,b\}}+y\frac{b}{\gcd\{a,b\}}\right)$

\begin{aligned} \max A&=\gcd\{a,b\}\left(\frac{ab}{\gcd^2\{a,b\}}-\frac{a}{\gcd\{a,b\}}-\frac{b}{\gcd\{a,b\}}\right)\\ &=\operatorname{lcm}\{a,b\}-a-b \end{aligned}