Analysis and Solution: Divide X into blocks and use induction on p.
When p=1, X={1,2}, take A={1}, then f(1)=1;
When p=2, X={1,2,3,4}, divide X into 3 subsets: {1,2}, {3}, {4}. Then A can contain at most one number from each subset, so ∣A∣⩽3. Take A={1,3,4}, then f(2)=3;
When p=3, X={1,2,⋯,8}. Divide X into 5 subsets: {1,2}, {3,6}, {4,8}, {5}, {7}. Then A can contain at most one number from each subset, so ∣A∣⩽5. Take A={1,5,6,7,8}, then f(3)=5.
In general, when Xp={1,2,3,⋯,2p}, we can estimate by dividing into blocks. Notice that 2p−1+1, 2p−1+2,⋯,2p can all belong to A, so we think of dividing into blocks: X={1,2,3,⋯,2p−1}∪{2p−1+ 1,2p−1+2,⋯,2ρ}=Xp−1∪M, where Xp−1={1,2,3,⋯,2p−1}, M={2ρ−1+ 1,2p−1+2,⋯,2p}. This way, the problem is how many numbers in Xp−1={1,2,3,⋯,2p−1} can belong to A, is this the original problem for p−1? The problem is not that simple! Consider: when all numbers 2p−1+1,2p−1+2,⋯,2p in M belong to A, many numbers in Xp−1 cannot belong to A, for example: 2p−2+1,2p−2+2,⋯,2p−1 do not belong to A; but not necessarily 2p−1+2,2p−1+4,⋯,2p all belong to A. Therefore, we need to make a finer division: some numbers 2p−1+2,2p−1+4,⋯,2p in M and relevant numbers in Xp−1 (with a 2-fold relationship) are paired to form sets: {2p−1+2,2p−2+1}, {2p−1+4,2p−2+2}, ⋯, {2p,2p−1}. This gives a partition of Xp:
Xp−22ρ−2),M0={1,2,3,⋯,2ρ−2},Mt={2ρ−1+2t,2ρ−2+t}(t=1,2,⋯,={2ρ−1+1,2ρ−1+3,2p−1+5,⋯,2p−1+2ρ−1−1}.
Since A can contain at most one element from Mt(t=1,2,⋯,2p−2), at most f(p−2) elements from Xp−2, and at most 2p−2 elements from M0, we have f(p)⩽f(p−2)+2p−2+ 2p−2=f(p−2)+2p−1.
Next, consider whether we can construct a set A to prove f(p)⩾f(p−2)+2p−1.
Let X={1,2,3,⋯,2p−2} have a maximum subset A1 that meets the conditions, and let A2= {2p−1+1,2p−1+2,⋯,2p}. Then for any x∈A1, we have 2x⩽2⋅2p−2=2p−1< 2p−1+1∈/A2, so A=A1∪A2 is a subset that meets the conditions, hence f(p)⩾∣A∣= f(p−2)+2p−1.
In summary, f(p)=f(p−2)+2p−1.
We solve this recurrence relation in two ways.
Method 1: Iteration (sum of p equations), we get f(p−1)+f(p)=f(1)+f(2)+ 22+23+⋯+2p−1=1+(20+21)+22+23+⋯+2p−1=2p.
Iterate again (subtract the (p−1)-th equation from the (p−2)-th equation, add the (p−3)-th equation, etc.), we get
f(p)+(−1)pf(1)=2p−2p−1+⋯+(−1)p⋅22,
so f(p)=2p−2p−1+⋯+(−1)p⋅22+(−1)p+1,
Notice that (−1)p+1⋅21+(−1)p+2⋅20=(−1)p+1(2−1)=(−1)p+1,
so f(p)=2p−2p−1+⋯+(−1)p⋅22+(−1)p+1⋅21+(−1)p+2⋅20
=1+212p[1−(−21)p+1]=32p+1+(−1)p
Method 2: Categorize and solve.
When p is odd, f(p)=f(p−2)+2p−1=f(p−4)+2p−3+2p−1= f(1)+22+24+⋯+2p−1=20+22+24+⋯+2p−1=32p+1−1;
When p is even, f(p)=f(p−2)+2p−1=f(p−4)+2p−3+2p−1= f(2)+23+25+⋯+2p−1=1+21+23+25+⋯+2p−1=32p+1+1.