返回题库

PUMaC 2009 · 数论(A 组) · 第 7 题

PUMaC 2009 — Number Theory (Division A) — Problem 7

专题
Contest Math / 竞赛数学
难度
L3
来源
PUMaC

题目详情

英文原题

  1. Let S = { p/q | q ≤ 2009, p/q < 1257 / 2009, p, q ∈ N }. If the maximum element of S is p0/q0p_{0}/q_{0} in
    reduced form, find p0+q0p_{0}+q_{0}.
解析

求不超过 1257/20091257/2009 的最大分数 p/qp/q(q≤2009q \le 2009)。

由连分数展开 1257/2009=[0;1,1,1,2,22,2,5]1257/2009 = [0;1,1,1,2,22,2,5],或其 Farey 左邻居。

解 1257q−2009p=11257q - 2009p = 1,q≤2009q \le 2009。由扩展欧几里得算法得最小正整数解 (p,q)=(229,366)(p,q) = (229, 366)。

229/366229/366 为 F2009F_{2009} 中 1257/20091257/2009 的直接前驱。已约分,gcd⁡=1\gcd=1。

p0+q0=229+366=595p_0+q_0 = 229+366 = \boxed{595}。


英文解析

S={p/q:q≤2009,p/q<1257/2009,p,q∈N}S = \{p/q : q \le 2009, p/q < 1257/2009, p,q \in \mathbb{N}\}. Find max element p0/q0p_0/q_0 in reduced form, compute p0+q0p_0+q_0.

This is finding the fraction just below 1257/20091257/2009 with denominator ≤2009\le 2009. This is a Farey sequence / continued fraction problem.

Compute the continued fraction of 1257/20091257/2009 and take the penultimate convergent, or use the property of Farey neighbors.

2009/12572009/1257: 2009=1⋅1257+7522009 = 1 \cdot 1257 + 752. 1257=1⋅752+5051257 = 1 \cdot 752 + 505. 752=1⋅505+247752 = 1 \cdot 505 + 247. 505=2⋅247+11505 = 2 \cdot 247 + 11. 247=22⋅11+5247 = 22 \cdot 11 + 5. 11=2⋅5+111 = 2 \cdot 5 + 1. 5=5⋅1+05 = 5 \cdot 1 + 0.

Continued fraction: 1257/2009=[0;1,1,1,2,22,2,5]1257/2009 = [0; 1, 1, 1, 2, 22, 2, 5].

The convergents:
c0=0/1c_0 = 0/1
c1=1/1c_1 = 1/1
c2=1/2c_2 = 1/2
c3=2/3c_3 = 2/3
c4=5/8c_4 = 5/8
c5=112/179c_5 = 112/179 (since 2+1/22=45/222+1/22 = 45/22, then invert... let me compute properly)
c6=229/366c_6 = 229/366
c7=1257/2009c_7 = 1257/2009

Actually, let me compute the convergents step by step:
[0;1,1,1,2,22,2,5][0; 1, 1, 1, 2, 22, 2, 5]

p−2=0,p−1=1,q−2=1,q−1=0p_{-2}=0, p_{-1}=1, q_{-2}=1, q_{-1}=0

a0=0a_0=0: p0=0,q0=1p_0=0, q_0=1
a1=1a_1=1: p1=1,q1=1p_1=1, q_1=1
a2=1a_2=1: p2=1,q2=1+1=2p_2=1, q_2=1+1=2... wait: p2=a2p1+p0=1⋅1+0=1p_2 = a_2 p_1 + p_0 = 1·1+0=1, q2=a2q1+q0=1⋅1+1=2q_2 = a_2 q_1 + q_0 = 1·1+1=2.
a3=1a_3=1: p3=1⋅1+1=2p_3 = 1·1+1=2, q3=1⋅2+1=3q_3 = 1·2+1=3.
a4=2a_4=2: p4=2⋅2+1=5p_4 = 2·2+1=5, q4=2⋅3+2=8q_4 = 2·3+2=8.
a5=22a_5=22: p5=22⋅5+2=112p_5 = 22·5+2=112, q5=22⋅8+3=179q_5 = 22·8+3=179.
a6=2a_6=2: p6=2⋅112+5=229p_6 = 2·112+5=229, q6=2⋅179+8=366q_6 = 2·179+8=366.
a7=5a_7=5: p7=5⋅229+112=1257p_7 = 5·229+112=1257, q7=5⋅366+179=2009q_7 = 5·366+179=2009.

The convergents are: 0/1, 1/1, 1/2, 2/3, 5/8, 112/179, 229/366, 1257/2009.

The fraction just below 1257/20091257/2009 with denominator ≤2009\le 2009: among fractions with denominator ≤2009\le 2009, the maximum less than 1257/20091257/2009 could be a Farey neighbor or a convergent. The penultimate convergent 229/366229/366 is less than 1257/20091257/2009.

Check other candidates: the fraction (1257k−1)/(2009k)(1257k-1)/(2009k) for appropriate kk, or use the mediant of convergents.

For the best rational approximation with bounded denominator, we check fractions between 229/366229/366 and 1257/20091257/2009. The mediant is (229+1257)/(366+2009)=1486/2375(229+1257)/(366+2009) = 1486/2375, denominator > 2009.

We can also compute (1257m−1)/(2009m)(1257m - 1)/(2009m) for m=1m=1: 1256/20091256/2009, which is less than 1257/20091257/2009 and has denominator 2009. But is there a fraction with denominator ≤ 2009 that's between 1256/20091256/2009 and 1257/20091257/2009?

Actually, using the theory: the fraction just below a/ba/b in the Farey sequence of order NN is obtained from the extended Euclidean algorithm. For 1257/20091257/2009 with N=2009N=2009, the previous term in F2009F_{2009} is found by solving 2009x−1257y=12009x - 1257y = 1 for positive x,yx,y with x≤2009x \le 2009. Then (x−y)/x(x-y)/x or similar...

Solving 2009x−1257y=12009x - 1257y = 1:
2009−1⋅1257=7522009 - 1·1257 = 752
1257−1⋅752=5051257 - 1·752 = 505
752−1⋅505=247752 - 1·505 = 247
505−2⋅247=11505 - 2·247 = 11
247−22⋅11=5247 - 22·11 = 5
11−2⋅5=111 - 2·5 = 1

Working backwards:
1=11−2⋅51 = 11 - 2·5
=11−2(247−22⋅11)=45⋅11−2⋅247= 11 - 2(247-22·11) = 45·11 - 2·247
=45(505−2⋅247)−2⋅247=45⋅505−92⋅247= 45(505-2·247) - 2·247 = 45·505 - 92·247
=45⋅505−92(752−505)=137⋅505−92⋅752= 45·505 - 92(752-505) = 137·505 - 92·752
=137(1257−752)−92⋅752=137⋅1257−229⋅752= 137(1257-752) - 92·752 = 137·1257 - 229·752
=137⋅1257−229(2009−1257)=366⋅1257−229⋅2009= 137·1257 - 229(2009-1257) = 366·1257 - 229·2009

So x=366x=366, y=229y=229. Check: 2009⋅366−1257⋅229=735294−287853=4474412009·366 - 1257·229 = 735294 - 287853 = 447441? That's not 1. Let me recheck.

Hmm, that doesn't give 1. Let me redo: 366⋅1257−229⋅2009=1366·1257 - 229·2009 = 1.
366⋅1257=366⋅1257366·1257 = 366·1257. 366⋅1200=439200,366⋅57=20862366·1200=439200, 366·57=20862. Sum = 460062.
229⋅2009=229⋅2000+229⋅9=458000+2061=460061229·2009 = 229·2000+229·9 = 458000+2061 = 460061.
Yes: 460062 - 460061 = 1. ✓

So (x,y)=(366,229)(x,y) = (366, 229) with 2009⋅366−1257⋅229=−12009·366 - 1257·229 = -1, wait:
Actually 2009⋅(−366)+1257⋅229=−12009·(-366) + 1257·229 = -1, so 1257⋅229−2009⋅366=−11257·229 - 2009·366 = -1, so 2009⋅366−1257⋅229=12009·366 - 1257·229 = 1. So x=366,y=229x=366, y=229.

The fraction just below 1257/20091257/2009 in F2009F_{2009} is (1257⋅229−1)/(2009⋅229)(1257·229 - 1)/(2009·229) ... hmm, that's not right.

The standard result: if bx−ay=1bx - ay = 1, then y/x<a/by/x < a/b and y/xy/x is the immediate predecessor of a/ba/b in the Farey sequence FbF_b.

Here 2009⋅366−1257⋅229=12009·366 - 1257·229 = 1, wait no: 2009⋅366−1257⋅229=735294−287853=4474412009·366 - 1257·229 = 735294 - 287853 = 447441, not 1.

I had the signs wrong. Let me redo: 1257⋅229−2009⋅366=−11257·229 - 2009·366 = -1, so 2009⋅366−1257⋅229=12009·366 - 1257·229 = 1. But 366 and 229 are the coefficients, not the numerator/denominator.

Actually, the equation a⋅x−b⋅y=±1a·x - b·y = ±1 gives Farey neighbors. If 2009x−1257y=12009x - 1257y = 1, then y/xy/x is the predecessor. Here 2009⋅366−1257⋅229=12009·366 - 1257·229 = 1 doesn't hold. Let me check: 2009⋅366=7352942009·366 = 735294. 1257⋅229=2878531257·229 = 287853. 735294−287853=447441≠1735294 - 287853 = 447441 \neq 1.

I made an arithmetic error. Let me redo the extended Euclidean algorithm properly.

Actually, from the earlier backward substitution:
366⋅1257−229⋅2009=460062−460061=1366·1257 - 229·2009 = 460062 - 460061 = 1. ✓

So 1257⋅366−2009⋅229=11257·366 - 2009·229 = 1. Rearranged: 2009⋅229−1257⋅366=−12009·229 - 1257·366 = -1. The Farey neighbor below 1257/20091257/2009 with denominator ≤ 2009 is 229/366229/366.

But wait, 229/366<1257/2009229/366 < 1257/2009? 229⋅2009=460061229·2009 = 460061, 1257⋅366=4600621257·366 = 460062. Yes, 229⋅2009<1257⋅366229·2009 < 1257·366, so 229/366<1257/2009229/366 < 1257/2009.

Is there any fraction between 229/366229/366 and 1257/20091257/2009 with denominator ≤ 2009? The next fraction in F2009F_{2009} after 229/366229/366 is the mediant with the next Farey neighbor.

The mediant (229+1257)/(366+2009)=1486/2375(229+1257)/(366+2009) = 1486/2375 has denominator > 2009. The fraction just below 1257/20091257/2009 in F2009F_{2009} is NOT necessarily 229/366229/366 because there could be fractions between them with denominator ≤ 2009.

Let me check: we need the largest fraction p/q<1257/2009p/q < 1257/2009 with q≤2009q \le 2009. This is equivalent to finding the fraction p/qp/q maximizing p/qp/q subject to 2009p−1257q<02009p - 1257q < 0 and q≤2009q \le 2009.

2009p−1257q≤−12009p - 1257q \le -1. Minimize 1257q−2009p1257q - 2009p subject to this being positive and q≤2009q \le 2009.

The optimal solution to 1257q−2009p=11257q - 2009p = 1 with q≤2009q \le 2009 gives the answer. From above: 1257⋅366−2009⋅229=11257·366 - 2009·229 = 1, so q=366q=366, p=229p=229. But 366≤2009366 \le 2009, so this is feasible. The fraction is 229/366229/366.

But we can also try 1257q−2009p=k1257q - 2009p = k for k>1k > 1, which would give a fraction even closer to 1257/20091257/2009 (since (1257q−k)/(2009q)<1257/2009(1257q - k)/(2009q) < 1257/2009, and as kk increases, the fraction gets smaller, not larger). Wait: for p/q<1257/2009p/q < 1257/2009, we want the LARGEST such fraction. 1257/2009−p/q=(1257q−2009p)/(2009q)1257/2009 - p/q = (1257q - 2009p)/(2009q). To maximize p/qp/q, we minimize 1257q−2009p1257q - 2009p (positive). The minimum positive value is 1.

So the maximum fraction p/q<1257/2009p/q < 1257/2009 with denominator unbounded but q≤2009q \le 2009 is given by solving 1257q−2009p=11257q - 2009p = 1 with q≤2009q \le 2009. The solution with smallest qq is (p,q)=(229,366)(p,q) = (229, 366). But wait, we want to MAXIMIZE p/qp/q, not minimize qq. With 1257q−2009p=11257q - 2009p = 1, p=(1257q−1)/2009p = (1257q-1)/2009. For this to be integer, 1257q≡1(mod2009)1257q \equiv 1 \pmod{2009}. The smallest positive qq is 366, giving p=229p=229. The next qq would be 366+2009=2375366+2009=2375, which exceeds 2009.

So p0=229p_0 = 229, q0=366q_0 = 366. The fraction is 229/366229/366 in reduced form (gcd=1). p0+q0=229+366=595p_0+q_0 = 229+366 = 595.

But wait, is 229/366229/366 really the max? Let me verify: 229/366≈0.62568229/366 ≈ 0.62568, 1257/2009≈0.62568...1257/2009 ≈ 0.62568... 1257/2009=0.625684...1257/2009 = 0.625684... 229/366=0.625683...229/366 = 0.625683... Yes, very close.

Could there be a fraction p/qp/q with q<366q<366 that's even closer? Let me check: 1257/2009−5/8=0.62568−0.625=0.000681257/2009 - 5/8 = 0.62568 - 0.625 = 0.00068. 1257/2009−229/366≈01257/2009 - 229/366 ≈ 0. 5/8=0.6255/8=0.625. Compare: 5⋅2009=100455·2009=10045, 1257⋅8=100561257·8=10056. 10045<1005610045<10056, so 5/8<1257/20095/8<1257/2009.

The gap: 1257/2009−5/8=(1257⋅8−2009⋅5)/(2009⋅8)=(10056−10045)/16072=11/16072≈0.0006841257/2009 - 5/8 = (1257·8 - 2009·5)/(2009·8) = (10056-10045)/16072 = 11/16072 ≈ 0.000684.

The gap: 1257/2009−229/366=1/(2009⋅366)≈1/735294≈0.000001361257/2009 - 229/366 = 1/(2009·366) ≈ 1/735294 ≈ 0.00000136.

So 229/366229/366 is much closer. Is there any fraction between with denominator ≤ 2009? The Farey sequence property guarantees that between Farey neighbors there's no fraction with smaller denominator. Since 229/366229/366 and 1257/20091257/2009 are neighbors in some Farey sequence (specifically Fmax⁡(366,2009)=F2009F_{\max(366,2009)} = F_{2009}), there's no fraction between them with denominator ≤ 2009.

So the max is 229/366229/366, p0+q0=595p_0+q_0 = 595.

But let me double-check: 229 and 366 are coprime? gcd(229,366): 366 = 1·229+137, 229=1·137+92, 137=1·92+45, 92=2·45+2, 45=22·2+1. Yes, gcd=1.

Reduced form: 229/366229/366. p0+q0=595p_0+q_0 = \boxed{595}.