Let p and q be two coprime positive integers, and let n be a nonnegative integer. Determine the number of integers that can be written in the form ip+jq, where i and j are nonnegative integers with i+j≤n. (posed by Li Weigu)
Solution
Define a set S(p,q,n)={ip+jq∣i and j are nonnegative integers with i+j≤n} Let sn=∣S(p,q,n)∣, where ∣X∣ denotes the number of elements in set X. The answer of the problem is sn=⎩⎨⎧2(n+1)(n+2),2r(2n−r+3),if n<r,if n≥r, where r=max{p,q}.
Now we establish the equation (∗). Without loss of generality, we assume that r=p>q. It is easy to see that s0=∣S(p,q,0)∣=∣{0}∣=1 satisfying equation (∗). Note that S(p,q,n)∖S(p,q,n−1)⊆{ip+(n−i)q∣i=0,1,…,n}. Note also that ip+(n−i)q=(i+q)p+(n−p−i)q, with (i+q)+(n−p−i)=n+q−p≤n−1. Hence number ip+(n−i)q belongs to both sets S(p,q,n) and S(p,q,n−1) if and only if n−p−i≥0, or i≤n−p. Therefore, S(p,q,n)∖S(p,q,n−1)={{ip+(n−i)q∣i=n−p+1,n−p+2,…,n},{ip+(n−i)q∣i=0,1,…,n},if n≥p,if n<p. It implies that sn−sn−1={p,n+1,if n≥p,if n<p. If n<p, we conclude that sn=s0+(s1−s0)+⋯+(sn−sn−1) =1+2+⋯+(n+1)=2(n+1)(n+2). In particular, sp−1=2p(p+1). If n≥p, we conclude that sn=sp−1+(sp−sp−1)+⋯+(sn−sn−1)=2p(p+1)+(n−p+1)p=2p(2n−p+3).
Want a route through all this instead of an archive? The track
puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.
Source: MathNet,
licensed CC-BY-4.0.
Statement and solution reproduced as published; topic and difficulty added by this site.