All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Probability
52-card lottery (Posted on 2023-03-29) Difficulty: 3 of 5

Let a 52 deck of numbered cards be created as follows:

2 special cards: 0 and 1
25 powers of 2: 2, 4, 8, ..., 2^25
25 powers of 3: 3, 9, 27, ..., 3^25

Shuffle the deck and draw at random 3 cards. Evaluate the product of the 3 numbers, say P.

What is the probability of P=0?
What is the probability of P being a non zero integer square?
What is the probability of P being a 4-digit number?

No Solution Yet Submitted by Ady TZIDON    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer solution | Comment 5 of 12 |
The three probabilities are:
probability of P=0:       0.057692307692307696 which is 3/52
non zero integer square:  0.28022624434389143
a 4-digit number:         0.006470588235294118

The 3 numerators are 1275, 6193, 143 respectively
Each denominator is: comb(52,3) = 22100

def isSquare(n):
    """ Input an integer, Returns True iff it is a perfect square. """
    if round(n**0.5)**2 == n:
        return True
    else:
        return False
    
c2s = [2**i for i in range(26)]
c3s = [3**i for i in range(1,26)]
cards = sorted([0]+c2s+c3s)
from itertools import combinations

zeros = 0
squares = 0
fourdigs = 0
count = 0
for comb in combinations(cards,3):
    p = comb[0] * comb[1] * comb[2]
    count += 1
    if p == 0:
        zeros += 1
    else:
        if isSquare(p):
            squares += 1
        if len(str(p)) == 4:
            fourdigs += 1

print(zeros/count, squares/count, fourdigs/count)
print(zeros, squares, fourdigs)

Output:
0.057692307692307696 0.28022624434389143 0.006470588235294118

1275 6193 143

Edited on March 29, 2023, 9:06 am
  Posted by Larry on 2023-03-29 09:01:20

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information