๐งต is /sci/ smarter than /g/?
Anonymous at Mon, 27 May 2024 01:04:39 UTC No. 16195066
can /sci/ find a closed form solution? or at least an exact solution of some form?
Anonymous at Mon, 27 May 2024 02:44:47 UTC No. 16195173
>>16195066
50% either you get a bar or you don't
Anonymous at Mon, 27 May 2024 02:54:20 UTC No. 16195183
>>16195066
snake_case convention grugNoLike
Anonymous at Mon, 27 May 2024 03:14:21 UTC No. 16195200
>>16195066
[code]
def chance_of(num_bars):
# Base case: If num_bars is 0, there's a 50% chance of getting nothing
if num_bars == 0:
return 0.5635083268962915574
# Recursive case
# Probability of having num_bars gold bars
prob = 0.0
# Case 1: The current chest contains nothing
if num_bars == 0:
prob += 0.5
# Case 2: The current chest contains a gold bar
if num_bars >= 1:
prob += 0.3 * chance_of(num_bars - 1)
# Case 3: The current chest contains 2 more chests
if num_bars >= 0:
for i in range(num_bars + 1):
prob += 0.2 * chance_of(i) * chance_of(num_bars - i)
return prob
# Example usage:
print(chance_of(0)) # Probability of getting 0 gold bars
print(chance_of(1)) # Probability of getting 1 gold bar
print(chance_of(2)) # Probability of getting 2 gold bars
print(chance_of(3)) # Probability of getting 3 gold bars
[/code]
Anonymous at Mon, 27 May 2024 03:22:14 UTC No. 16195204
>>16195200
No memoization therefore you failed
Anonymous at Mon, 27 May 2024 16:17:19 UTC No. 16196045
>>16195066
my bend equivalent of a zip bomb at least runs entirely in vram and won't hog up anything of value
Anonymous at Tue, 28 May 2024 06:47:48 UTC No. 16197227
>>16195066
G=0.3+0.2*2G
G=0.5
50% either you get it or you don't indeed
Anonymous at Tue, 28 May 2024 15:51:56 UTC No. 16197807
Pr(G=0)=0.5+0.2*Pr(G=0)*Pr(G=0)
Pr(G=0)=2.5-0.5sqrt(15)
Pr(G=1)=0.3+0.2*(Pr(G=0)*Pr(G=1)+Pr
Pr(G=1)=0.1sqrt(15)
Pr(G=2)=0.2*(Pr(G=0)*Pr(G=2)+Pr(G=1
Pr(G=2)=(Pr(G=1)*Pr(G=1))/sqrt(15)
Pr(G=2)=0.01sqrt(15)
Pr(G=3)=0.2*(Pr(G=0)*Pr(G=3)+Pr(G=1
Pr(G=3)=(Pr(G=1)*Pr(G=2)+Pr(G=2)*Pr
Pr(G=3)=0.002sqrt(15)
Pr(G=4)=0.2*(Pr(G=0)*Pr(G=4)+Pr(G=1
Pr(G=4)=(Pr(G=1)*Pr(G=3)+Pr(G=2)*Pr
Pr(G=4)=0.0005sqrt(15)
Pr(G=5)=(Pr(G=1)*Pr(G=4)+Pr(G=2)*Pr
Pr(G=5)=0.00014sqrt(15)
you can see the recursive pattern that forms here
is there a closed form expression?
Anonymous at Tue, 28 May 2024 20:06:41 UTC No. 16198146
>>16195066
Chance of 0 : 0.563503
Chance of 1 : 0.387326
Chance of 2 : 0.0387108
Chance of 3 : 0.00773915
Chance of 4 : 0.00193532
Chance of 5 : 0.00054578
Chance of 6 : 0.00016286
Chance of 7 : 5.152e-05
Chance of 8 : 1.685e-05
Chance of 9 : 5.48e-06
Chance of 10 : 1.85e-06
Chance of 11 : 7.1e-07
Chance of 12 : 2.6e-07
Chance of 13 : 7e-08
Chance of 14 : 3e-08
Chance of 15 : 1e-08
Chance of 16 : 0
Chance of 17 : 0
Chance of 18 : 0
Chance of 19 : 0
Chance of 20+ : 0
https://godbolt.org/z/hY833PTrs
Anonymous at Wed, 29 May 2024 02:01:13 UTC No. 16198533
https://godbolt.org/z/d9nWs3b5P
chance_of(0) = 2.5 - 0.5 * sqrt(15) = 0.563508
chance_of(1) = 0.1 * sqrt(15) = 0.387298
chance_of(2) = 0.01 * sqrt(15) = 0.0387298
chance_of(3) = 0.002 * sqrt(15) = 0.00774597
chance_of(4) = 0.0005 * sqrt(15) = 0.00193649
chance_of(5) = 0.00014 * sqrt(15) = 0.000542218
chance_of(6) = 4.2e-05 * sqrt(15) = 0.000162665
chance_of(7) = 1.32e-05 * sqrt(15) = 5.11234e-05
chance_of(8) = 4.29e-06 * sqrt(15) = 1.66151e-05
chance_of(9) = 1.43e-06 * sqrt(15) = 5.53837e-06
chance_of(10) = 4.862e-07 * sqrt(15) = 1.88304e-06
chance_of(11) = 1.6796e-07 * sqrt(15) = 6.50506e-07
chance_of(12) = 5.8786e-08 * sqrt(15) = 2.27677e-07
chance_of(13) = 2.08012e-08 * sqrt(15) = 8.05627e-08
chance_of(14) = 7.429e-09 * sqrt(15) = 2.87724e-08
chance_of(15) = 2.67444e-09 * sqrt(15) = 1.03581e-08
chance_of(16) = 9.69485e-10 * sqrt(15) = 3.7548e-09
chance_of(17) = 3.53577e-10 * sqrt(15) = 1.3694e-09
chance_of(18) = 1.29645e-10 * sqrt(15) = 5.02112e-10
chance_of(19) = 4.77639e-11 * sqrt(15) = 1.84989e-10
chance_of(20) = 1.76726e-11 * sqrt(15) = 6.84458e-11
Anonymous at Wed, 29 May 2024 02:13:50 UTC No. 16198544
Attention /g/ brainlets, the problem doesn't specify you have to open a chest. Your answer for one gold bar must be 3/10.
Anonymous at Wed, 29 May 2024 02:15:51 UTC No. 16198545
>>16198544
if you don't need to open every chest then the answer is any number from 0 to 0.387298 depending on the user's actions