The given conditions determine f uniquely on the positive integers. The signs of f(1),f(2),… seem to change quite erratically. However, values of the form f(2n−t(m)) are sufficient to compute directly any functional value. Indeed, let n>0 have base 2 representation n=2a0+2a1+⋯+2ak,a0>a1>⋯>ak≥0, and let nj=2aj+2aj−1+⋯+2ak,j=0,…,k. Repeated applications of the recurrence show that f(n) is an alternating sum of the quantities f(2aj−t(nj+1)) plus (−1)k+1. (The exact formula is not needed for our proof.)
So we focus attention on the values f(2n−1),f(2n−2) and f(2n−3). Six cases arise; more specifically,
t(22k−3)=2, t(22k−2)=1, t(22k−1)=3, t(22k+1−3)=1, t(22k+1−2)=3, t(22k+1−1)=2.
Claim. For all integers k≥0 the following equalities hold:
f(22k+1−3)=0,f(22k+2−3)=−3k,f(22k+1−2)=3k,f(22k+2−2)=−3k,f(22k+1−1)=−3k,f(22k+2−1)=2⋅3k
Proof. By induction on k. The base k=0 comes down to checking that f(2)=−1 and f(3)=2; the given values f(−1)=0,f(0)=1,f(1)=−1 are also needed. Suppose the claim holds for k−1. For f(22k+1−t(m)), the recurrence formula and the induction hypothesis yield
f(22k+1−3)=f(22k+(22k−3))=f(22k−2)−f(22k−3)=−3k−1+3k−1=0,f(22k+1−2)=f(22k+(22k−2))=f(22k−1)−f(22k−2)=2⋅3k−1+3k−1=3k,f(22k+1−1)=f(22k+(22k−1))=f(22k−3)−f(22k−1)=−3k−1−2⋅3k−1=−3k.
For f(22k+2−t(m)) we use the three equalities just established:
f(22k+2−3)=f(22k+1+(22k+1−3))=f(22k+1−1)−f(22k+1−3)=−3k−0=−3k,f(22k+2−2)=f(22k+1+(22k+1−2))=f(22k+1−3)−f(22k−2)=0−3k=−3k,f(22k+2−1)=f(22k+1+(22k+1−1))=f(22k+1−2)−f(22k+1−1)=3k+3k=2⋅3k.
The claim follows.
A closer look at the six cases shows that f(2n−t(m))≥3(n−1)/2 if 2n−t(m) is divisible by 3, and f(2n−t(m))≤0 otherwise. On the other hand, note that 2n−t(m) is divisible by 3 if and only if 2n+m is. Therefore, for all nonnegative integers m and n,
(i) f(2n−t(m))≥3(n−1)/2 if 2n+m is divisible by 3 ;
(ii) f(2n−t(m))≤0 if 2n+m is not divisible by 3 .
One more (direct) consequence of the claim is that ∣f(2n−t(m))∣≤32⋅3n/2 for all m,n≥0.
The last inequality enables us to find an upper bound for ∣f(m)∣ for m less than a given power of 2. We prove by induction on n that ∣f(m)∣≤3n/2 holds true for all integers m,n≥0 with 2n>m.
The base n=0 is clear as f(0)=1. For the inductive step from n to n+1, let m and n satisfy 2n+1>m. If m<2n, we are done by the inductive hypothesis. If m≥2n then m=2n+k where 2n>k≥0. Now, by ∣f(2n−t(k))∣≤32⋅3n/2 and the inductive assumption,
∣f(m)∣=∣f(2n−t(k))−f(k)∣≤∣f(2n−t(k))∣+∣f(k)∣≤32⋅3n/2+3n/2<3(n+1)/2
The induction is complete.
We proceed to prove that f(3p)≥0 for all integers p≥0. Since 3p is not a power of 2, its binary expansion contains at least two summands. Hence one can write 3p=2a+2b+c where a>b and 2b>c≥0. Applying the recurrence formula twice yields
f(3p)=f(2a+2b+c)=f(2a−t(2b+c))−f(2b−t(c))+f(c)
Since 2a+2b+c is divisible by 3, we have f(2a−t(2b+c))≥3(a−1)/2 by (i). Since 2b+c is not divisible by 3, we have f(2b−t(c))≤0 by (ii). Finally ∣f(c)∣≤3b/2 as 2b>c≥0, so that f(c)≥−3b/2. Therefore f(3p)≥3(a−1)/2−3b/2 which is nonnegative because a>b.