Each of A and B is a positive real number.
Consider this function:
A*B
A o B = -----
A+B
Determine the value of:
21o(22o(23o ......o(22022 o 22023)))
The program I wrote gets an overflow error at 2^514
But the answer is a tiny finite amount above 1; certainly equal to 1 in the limit.
The computer solution having essentially failed, let's try analytic.
Analytic Solution
For any integer n,
2^(n-1)*2^n / (2^(n-1) + 2^n)
= 2^(2n-1) / (3*2^(n-1))
= 2^n / 3
If you apply the same function to 2^(n-2) and 2^n / 3, you get
= 2^n / 7
Combining that with 2^(n-3) ...
= 2^n / 15
continuing the pattern to include 2^(n-k) ...
= 2^n / ((2^k - 1)+(2^k)) or
= 2^n / (2^(k+1) - 1)
For our problem, n is 2023, we're going all the way to 1, so k is n-1.
So the final answer is
2^2023 / (2^2023 - 1)
----------------------
def o(a,b):
return a*b/(a+b)
def otower(n):
ans = o(2**n, 2**(n-1))
for i in range(n-2,0,-1):
ans = o(ans,2**i)
return ans
for n in range(2,520):
try:
print(n,otower(n))
except OverflowError:
break
|
Posted by Larry
on 2023-08-08 08:14:12 |