Skip to content

Instantly share code, notes, and snippets.

@Yossarian0916
Created April 26, 2019 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yossarian0916/0fcbaf0a61fb1ea34952359694823a0d to your computer and use it in GitHub Desktop.
Save Yossarian0916/0fcbaf0a61fb1ea34952359694823a0d to your computer and use it in GitHub Desktop.
how many girls should one date before he can be in a relationship with all 12 zodiac sign
"""
how many girls should one date before he can be in a relationship with
all 12 zodiac signs
"""
import random
def simulation():
count = 0
gf = set()
while len(gf) != 12:
girl = random.randint(1, 12)
gf.add(girl)
count += 1
return count
def run(times):
total_count = 0
for i in range(times):
count = simulation()
total_count += count
return total_count / times
if __name__ == '__main__':
res = run(50000)
print(res)
# the result should converge to 37.2385281 (12 × 𝐇₁₂, harmonic number)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment