MathLabs

Problem 3

Let 0<f(1)<f(2)<f(3)<…0<f(1)<f(2)<f(3)<\ldots be a sequence with all its terms positive integers. The nn-th positive integer which doesn't belong to the sequence is f(f(n))+1f(f(n))+1. Find f(240)f(240).
Step 2 of 5: Derive the counting recursion
In plain words

One known value supplies two new entries by counting the terms and gaps below it.

f(n)=k  ⟹  f(k)=n+k−1,f(k+1)=n+k+1f(n)=k \;\Longrightarrow\; f(k)=n+k-1,\quad f(k+1)=n+k+1
Detailed analysis

Let f(n)=kf(n)=k. The nn-th missing integer is f(k)+1f(k)+1, so among the integers 11 through f(k)+1f(k)+1 there are nn missing integers and kk sequence terms. Hence n+k=f(k)+1n+k=f(k)+1, giving f(k)=n+k−1f(k)=n+k-1. Therefore the nn-th missing integer is n+kn+k, so the next integer n+k+1n+k+1 belongs to the sequence and equals f(k+1)f(k+1).