题意:求 1 a + 1 b = p 1 0 n \frac{1}{a} + \frac{1}{b} = \frac{p}{10^n} a1+b1=10np的正整数解 ( 1 ≤ n ≤ 9 ) (1 \leq n \leq 9) (1≤n≤9)
对原式进行变化
1
a
+
1
b
=
p
1
0
n
\frac{1}{a} + \frac{1}{b} = \frac{p}{10^n}
a1+b1=10np
1
a
+
1
b
=
p
1
0
n
\frac{1}{a} + \frac{1}{b} = \frac{p}{10^n}
a1+b1=10np
a
b
p
2
−
1
0
n
p
(
a
+
b
)
=
0
abp^2-10^np(a+b)=0
abp2−10np(a+b)=0
a
b
p
2
−
1
0
n
p
(
a
+
b
)
+
1
0
2
n
=
1
0
2
n
abp^2-10^np(a+b)+10^{2n}=10^{2n}
abp2−10np(a+b)+102n=102n
(
p
a
−
1
0
n
)
(
p
b
−
1
0
n
)
=
1
0
2
n
(pa-10^n)(pb-10^n)=10^{2n}
(pa−10n)(pb−10n)=102n
设
X
=
p
a
−
1
0
n
X=pa-10^n
X=pa−10n,
Y
=
p
b
−
1
0
n
Y=pb-10^n
Y=pb−10n,对
1
0
2
n
10^{2n}
102n分解质因数
1
0
2
n
=
X
∗
Y
10^{2n}=X*Y
102n=X∗Y
p
a
=
1
0
n
+
X
,
p
b
=
1
0
n
+
Y
pa=10^n+X, pb=10^n+Y
pa=10n+X,pb=10n+Y
我们有
{
p
a
=
1
0
n
+
X
p
b
=
1
0
n
+
Y
\begin{cases} pa=10^n+X \\ pb=10^n+Y \end{cases}
{pa=10n+Xpb=10n+Y
对
1
0
n
+
X
10^n+X
10n+X分解质因数枚举
p
p
p的值,即可得到
a
a
a和
b
b
b的值