Solveeit Logo

Question

Question: Let $f(a, b)$ be a function with the following properties for all positive integers $a \neq b$: $f(...

Let f(a,b)f(a, b) be a function with the following properties for all positive integers aba \neq b:

f(1,2)=f(2,1)f(1, 2) = f(2, 1) f(a,b)+f(b,a)=0f(a, b) + f(b, a) = 0 f(a+b,b)=f(b,a)+bf(a + b, b) = f(b, a) + b

Compute:

i=12019f(4i1,2i)+f(4i+1,2i)\sum_{i=1}^{2019} f(4^i - 1, 2^i) + f(4^i + 1, 2^i)

Answer

2^{2021}-6

Explanation

Solution

The function f(a,b)f(a, b) has the properties:

  1. f(1,2)=f(2,1)f(1, 2) = f(2, 1)
  2. f(a,b)+f(b,a)=0    f(a,b)=f(b,a)f(a, b) + f(b, a) = 0 \implies f(a, b) = -f(b, a)
  3. f(a+b,b)=f(b,a)+bf(a + b, b) = f(b, a) + b

From (1) and (2), f(1,2)=f(1,2)    2f(1,2)=0    f(1,2)=0f(1, 2) = -f(1, 2) \implies 2f(1, 2) = 0 \implies f(1, 2) = 0. Also, f(2,1)=0f(2, 1) = 0.

From (3), substitute f(b,a)=f(a,b)f(b, a) = -f(a, b): f(a+b,b)=f(a,b)+bf(a+b, b) = -f(a, b) + b. Let X=a+bX = a+b, then a=Xba = X-b. So, f(X,b)=f(Xb,b)+bf(X, b) = -f(X-b, b) + b for X>bX > b. Applying this repeatedly: f(X,b)=(f(X2b,b)+b)+b=f(X2b,b)f(X, b) = -(-f(X-2b, b) + b) + b = f(X-2b, b). This implies f(a,b)=f(a2b,b)=f(a4b,b)=f(a, b) = f(a-2b, b) = f(a-4b, b) = \dots. Let a=qb+ra = qb + r, where q=a/bq = \lfloor a/b \rfloor and r=a(modb)r = a \pmod b.

  • If qq is even, f(a,b)=f(r,b)f(a, b) = f(r, b).
  • If qq is odd, f(a,b)=bf(r,b)f(a, b) = b - f(r, b).

If r=0r=0, i.e., aa is a multiple of bb: Using f(2,1)=0f(2, 1) = 0, where q=2q=2 (even) and r=0r=0, suggests f(0,1)=0f(0, 1) = 0. Using f(3,1)=f(1+2,1)=f(2,1)+1=0+1=1f(3, 1) = f(1+2, 1) = f(2, 1) + 1 = 0+1=1, where q=3q=3 (odd) and r=0r=0, suggests 1=1f(0,1)1 = 1 - f(0, 1), implying f(0,1)=0f(0, 1) = 0. So, we assume f(0,b)=0f(0, b) = 0 for any bb. Thus, if aa is a multiple of bb:

  • If q=a/bq = a/b is even, f(a,b)=0f(a, b) = 0.
  • If q=a/bq = a/b is odd, f(a,b)=bf(a, b) = b.

We need to compute S=i=12019(f(4i1,2i)+f(4i+1,2i))S = \sum_{i=1}^{2019} (f(4^i - 1, 2^i) + f(4^i + 1, 2^i)).

  1. Evaluate f(4i1,2i)f(4^i - 1, 2^i): Let a=4i1a = 4^i - 1 and b=2ib = 2^i. Since i1i \ge 1, a>ba > b. a=(2i)21a = (2^i)^2 - 1. The quotient q=((2i)21)/2i=2i1/2i=2i1q = \lfloor ( (2^i)^2 - 1 ) / 2^i \rfloor = \lfloor 2^i - 1/2^i \rfloor = 2^i - 1. The remainder r=(2i)21(mod2i)=2i1r = (2^i)^2 - 1 \pmod{2^i} = 2^i - 1. Since q=2i1q = 2^i - 1 is always odd for i1i \ge 1: f(4i1,2i)=bf(r,b)=2if(2i1,2i)f(4^i - 1, 2^i) = b - f(r, b) = 2^i - f(2^i - 1, 2^i). Now, evaluate f(2i1,2i)f(2^i - 1, 2^i). Let a=2i1a' = 2^i - 1 and b=2ib' = 2^i. Here a<ba' < b'. f(a,b)=f(b,a)=f(2i,2i1)f(a', b') = -f(b', a') = -f(2^i, 2^i - 1). For f(2i,2i1)f(2^i, 2^i - 1), let A=2iA = 2^i and B=2i1B = 2^i - 1. A>BA > B. A=1B+1A = 1 \cdot B + 1. So q=1q' = 1 (odd), r=1r' = 1. f(2i,2i1)=Bf(r,B)=(2i1)f(1,2i1)f(2^i, 2^i - 1) = B - f(r', B) = (2^i - 1) - f(1, 2^i - 1). For f(1,2i1)f(1, 2^i - 1), let A=1A'' = 1 and B=2i1B'' = 2^i - 1. Here A<BA'' < B''. f(1,2i1)=f(2i1,1)f(1, 2^i - 1) = -f(2^i - 1, 1). For f(2i1,1)f(2^i - 1, 1), let A=2i1A''' = 2^i - 1 and B=1B''' = 1. A>BA''' > B'''. q=(2i1)/1=2i1q''' = (2^i - 1)/1 = 2^i - 1 (odd for i1i \ge 1), r=0r''' = 0. So, f(2i1,1)=B=1f(2^i - 1, 1) = B''' = 1. Therefore, f(1,2i1)=1f(1, 2^i - 1) = -1. Substitute back: f(2i,2i1)=(2i1)(1)=2if(2^i, 2^i - 1) = (2^i - 1) - (-1) = 2^i. Thus, f(2i1,2i)=2if(2^i - 1, 2^i) = -2^i. Finally, f(4i1,2i)=2i(2i)=22i=2i+1f(4^i - 1, 2^i) = 2^i - (-2^i) = 2 \cdot 2^i = 2^{i+1}. This formula holds for i>1i > 1. For i=1i=1: f(411,21)=f(3,2)=21f(1,2)=20=2f(4^1 - 1, 2^1) = f(3, 2) = 2^1 - f(1, 2) = 2 - 0 = 2. So for i=1i=1, f(4i1,2i)=2if(4^i - 1, 2^i) = 2^i. For i>1i > 1, f(4i1,2i)=2i+1f(4^i - 1, 2^i) = 2^{i+1}.

  2. Evaluate f(4i+1,2i)f(4^i + 1, 2^i): Let a=4i+1a = 4^i + 1 and b=2ib = 2^i. Since i1i \ge 1, a>ba > b. a=(2i)2+1a = (2^i)^2 + 1. The quotient q=((2i)2+1)/2i=2i+1/2i=2iq = \lfloor ( (2^i)^2 + 1 ) / 2^i \rfloor = \lfloor 2^i + 1/2^i \rfloor = 2^i. The remainder r=(2i)2+1(mod2i)=1r = (2^i)^2 + 1 \pmod{2^i} = 1. Since q=2iq = 2^i is always an even number for i1i \ge 1: f(4i+1,2i)=f(r,b)=f(1,2i)f(4^i + 1, 2^i) = f(r, b) = f(1, 2^i). For f(1,2i)f(1, 2^i), let a=1a' = 1 and b=2ib' = 2^i. Here a<ba' < b'. f(1,2i)=f(2i,1)f(1, 2^i) = -f(2^i, 1). For f(2i,1)f(2^i, 1), let A=2iA = 2^i and B=1B = 1. A>BA > B. q=2i/1=2iq' = 2^i/1 = 2^i (even for i1i \ge 1), r=0r' = 0. So, f(2i,1)=0f(2^i, 1) = 0. Therefore, f(1,2i)=0=0f(1, 2^i) = -0 = 0. Thus, f(4i+1,2i)=0f(4^i + 1, 2^i) = 0 for all i1i \ge 1.

  3. Compute the sum: S=i=12019(f(4i1,2i)+f(4i+1,2i))S = \sum_{i=1}^{2019} (f(4^i - 1, 2^i) + f(4^i + 1, 2^i)) S=i=12019(f(4i1,2i)+0)S = \sum_{i=1}^{2019} (f(4^i - 1, 2^i) + 0) S=f(411,21)+i=22019f(4i1,2i)S = f(4^1 - 1, 2^1) + \sum_{i=2}^{2019} f(4^i - 1, 2^i) S=2+i=220192i+1S = 2 + \sum_{i=2}^{2019} 2^{i+1} The sum is 2+(22+1+23+1++22019+1)2 + (2^{2+1} + 2^{3+1} + \dots + 2^{2019+1}) S=2+(23+24++22020)S = 2 + (2^3 + 2^4 + \dots + 2^{2020}) The terms (23+24++22020)(2^3 + 2^4 + \dots + 2^{2020}) form a geometric series with first term a=23=8a = 2^3 = 8, common ratio r=2r=2, and number of terms n=20203+1=2018n = 2020 - 3 + 1 = 2018. The sum of this geometric series is 822018121=8(220181)=232201823=2202188 \frac{2^{2018} - 1}{2 - 1} = 8(2^{2018} - 1) = 2^3 \cdot 2^{2018} - 2^3 = 2^{2021} - 8. Therefore, S=2+(220218)=220216S = 2 + (2^{2021} - 8) = 2^{2021} - 6.