Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 0 JPs odds = 20.0 % ( 1/5 )
- better than in 100.0 % of cases
- 1 JPs odds = 25.666666666666664 % ( 77/300 )
- better than in 80.0 % of cases
- 2 JPs odds = 21.105555555555554 % ( 3799/18000 )
- better than in 54.333333333333336 % of cases
- 3 JPs odds = 14.232685185185185 % ( 153713/1080000 )
- better than in 33.22777777777778 % of cases
- 4 JPs odds = 8.605603395061728 % ( 5576431/64800000 )
- better than in 18.995092592592595 % of cases
- 5 JPs odds = 4.871278215020576 % ( 189395297/3888000000 )
- better than in 10.389489197530864 % of cases
- 6 JPs odds = 2.6444253425068585 % ( 6168915439/233280000000 )
- better than in 5.518210982510288 % of cases
- 7 JPs odds = 1.3968875985439528 % ( 195519563393/13996800000000 )
- better than in 2.873785640003429 % of cases
- 8 JPs odds = 0.724656520608401 % ( 6085723432591/839808000000000 )
- better than in 1.4768980414594763 % of cases
- 9 JPs odds = 0.37140634380957116 % ( 187146011269217/50388480000000000 )
- better than in 0.7522415208510755 % of cases
- 10 JPs odds = 0.18881637517154976 % ( 5708502086402479/3023308800000000000 )
- better than in 0.3808351770415043 % of cases
- 11 JPs odds = 0.09546812546593976 % ( 173177774304407873/181398528000000000000 )
- better than in 0.19201880186995457 % of cases
- 12 JPs odds = 0.04809300814416905 % ( 5234400530666566351/10883911680000000000000 )
- better than in 0.09655067640401481 % of cases
- 13 JPs odds = 0.02416757712260363 % ( 157822664953203874337/653034700800000000000000 )
- better than in 0.04845766825984575 % of cases
- 14 JPs odds = 0.01212450566663803 % ( 4750633758216522663919/39182082048000000000000000 )
- better than in 0.024290091137242124 % of cases
- 15 JPs odds = 0.006075915712581882 % ( 142840216780269414545153/2350924922880000000000000000 )
- better than in 0.012165585470604093 % of cases
- 16 JPs odds = 0.0030425349081549284 % ( 4291662686588300113213711/141055495372800000000000000000 )
- better than in 0.00608966975802221 % of cases
- EXPECTED NUMBER OF JPs: 2.0827848259840214
- I believe the actual expected number of joy pendants should be 25/12, as this can be seen as several negative binomial distributions which we can add up the expected number of JPs from.
- CODED WITH PYTHON:
- from fractions import *
- def auction():
- L=[]
- M=[]
- N=[]
- for i in range(17):
- L.append(auctionodd(i))
- M.append(morejpsthan(i))
- print(i,'JPs odds =',L[i][1]*100, '% (',L[i][0], ')' )
- print('better than in', M[i].numerator/M[i].denominator*100,'%','of cases')
- print()
- print('EXPECTED NUMBER OF JPs:',expectedwithlist(L))
- def auctionodd(n):
- rep=auction_aux(n,[1]*(n+4))
- return rep, rep.numerator/rep.denominator
- #liste de taille n+4 car n JPs et 4 items
- #dans la liste, 1 pour item, 0 pour JP
- def auction_aux(n,L):
- odd=0
- longueur=len(L)
- if n==0:
- return proba(L)
- else:
- if 0 not in L:
- latestjp=0
- else:
- for i in range(0, longueur-1):
- if L[i]==0:
- latestjp=i
- for i in range(latestjp,longueur-1):
- #starting at latestjp in order to have every case only show once
- if L[i]==1:
- L[i]=0
- odd+=auction_aux(n-1,L)
- #programme recursif
- L[i]=1
- return odd
- def proba(L):
- items=4
- odds=Fraction(1,1)
- longueur=len(L)
- for j in range(0,longueur):
- if L[j]==0:
- odds*=Fraction(1,items+1)
- else:
- odds*=Fraction(items,items+1)
- items-=1
- return odds
- def expectedwithlist(L):
- value=Fraction(0,1)
- n=len(L)
- for i in range(0,n):
- value+=i*L[i][0]
- return value.numerator/value.denominator
- def expected(n):
- value=0
- for i in range(0,n+1):
- value+=i*auctionodd(i)[1]
- return value
- def morejpsthan(n):
- return 1-sum(auctionodd(i)[0] for i in range(0,n))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement