Let n be a nonnegative integer. We have
f(2n)2<f(2n)2+6f(n)+1=f(2n+1)2<f(2n)2+6f(2n)+9=(f(2n)+3)2.
Therefore,
f(2n)<f(2n+1)<f(2n)+3.
Assume that f(2n+1)=f(2n)+2. In this case
6f(n)+1=f(2n+1)2−f(2n)2=4f(2n)+4.
This is impossible since the left hand side is odd while the right hand side is even. Therefore f(2n+1)=f(2n)+1.
On the other hand,
6f(n)+1=f(2n+1)2−f(2n)2=2f(2n)+1.
We deduce that f(2n)=3f(n), and f(0)=0.
Now, let n≥0 and write n=a1a2⋯ak(2) in basis 2. We prove by induction on k that f(n)=a1a2⋯ak(3) in basis 3.
For k=1, we have
f(0(2))=f(0)=0=0(3)andf(1(2))=f(1)=f(0)+1=1=1(3).
Assume this true for k. We have
f(a1a2⋯akak+1(2))=f(2a1a2⋯ak(2)+ak+1)=f(2a1a2⋯ak(2))+ak+1=3f(a1a2⋯ak(2))+ak+1=3a1a2⋯ak(3)+ak+1=a1a2⋯akak+1(3).
This completes the induction.
Applying this to 1000, we have
1000=1101001(3)=f(1101001(2))=f(105).