Skip to main content
minor improvements
Source Link
Tim
  • 141.2k
  • 26
  • 270
  • 512

Since by definition sum is always $10$ or more and mean of sum of points is sum/number_draws, than in fact you are interested in how many cards do you have to draw, on average, so their total score sums up to $10$ or more.

By your definition, you have $16$ cards ($10$, $\text{J}$, $\text{K}$, $\text{Q}$) that are worth $10$ points, so with probability $16/52$ you get $10$ points in a single draw. Since $9+\text{anything}=10$, then if we take into consideration that there is $4$ nines, than we instantly know that with probability greater than $20/52$ you finish in two draws. However, return of two draws is simple to obtain by enumerating all $52 \choose 2$ combinations of cardscard pairs and summing their scores. Since order of drawing cards does not matter there is $52 \choose 2$ possible combinations of card pairs:

unique_cards <- c(1:10, 10, 10, 10)  # A, 1, 2, ..., 10, J, Q, K
unique_cards <- rep(unique_cards, 4) # each appears 4 times

comb <- combn(unique_cards, 2) # take all possible combinations of card pairs

what gives $79\%$ probability of obtaining score of at least $10$ in two draws

> sum(colSums(comb) >= 10)/choose(52, 2) # accepted / all combinations
[1] 0.7888386

Lazy solution for more than two draws can be obtained by a simple simulation, where whole deck is shuffled and then cards are drawn until their total score is at least $10$.

set.seed(123)
    
sim <- function(target = 10) {
  res <- cumsum(sample(unique_cards)) # shuffle, draw and sum
  n <- which.max(res >= target)       # take first score >= 10
  c(sum = res[n], n = n)
}

R <- 1e4
res <- replicate(R, sim())

and the result is that on average you have to draw two cards and the average total score is $12.77$:

> apply(res, 1, summary)
          sum     n
Min.    10.00 1.000
1st Qu. 10.00 1.000
Median  12.00 2.000
Mean    12.77 1.946
3rd Qu. 15.00 2.000
Max.    19.00 6.000

moreoverMoreover, as expected, with approximately $30\%$ probability you finish with one draw, but with $79\%$ probability you finish with two draws and you rarely get over three draws:

 > cumsum(table(res[2,])/R)
     1      2      3      4      5      6 
0.3006 0.7910 0.9653 0.9968 0.9999 1.0000 

Since by definition sum is always $10$ or more and mean of sum of points is sum/number_draws, than in fact you are interested in how many cards do you have to draw, on average, so their total score sums up to $10$ or more.

By your definition, you have $16$ cards ($10$, $\text{J}$, $\text{K}$, $\text{Q}$) that are worth $10$ points, so with probability $16/52$ you get $10$ points in a single draw. Since $9+\text{anything}=10$, then if we take into consideration that there is $4$ nines, than we instantly know that with probability greater than $20/52$ you finish in two draws. However, return of two draws is simple to obtain by enumerating all combinations of cards and summing their scores. Since order of drawing cards does not matter there is $52 \choose 2$ possible combinations of card pairs:

unique_cards <- c(1:10, 10, 10, 10)  # A, 1, 2, ..., 10, J, Q, K
unique_cards <- rep(unique_cards, 4) # each appears 4 times

comb <- combn(unique_cards, 2) # take all possible combinations of card pairs

what gives $79\%$ probability of obtaining score of at least $10$ in two draws

> sum(colSums(comb) >= 10)/choose(52, 2)
[1] 0.7888386

Lazy solution for more than two draws can be obtained by a simple simulation, where whole deck is shuffled and then cards are drawn until their total score is at least $10$.

set.seed(123)
    
sim <- function(target = 10) {
  res <- cumsum(sample(unique_cards)) # shuffle, draw and sum
  n <- which.max(res >= target)       # take first score >= 10
  c(sum = res[n], n = n)
}

R <- 1e4
res <- replicate(R, sim())

and the result is that on average you have to draw two cards and the average total score is $12.77$:

> apply(res, 1, summary)
          sum     n
Min.    10.00 1.000
1st Qu. 10.00 1.000
Median  12.00 2.000
Mean    12.77 1.946
3rd Qu. 15.00 2.000
Max.    19.00 6.000

moreover, as expected with approximately $30\%$ probability you finish with one draw, but with $79\%$ probability you finish with two draws and you rarely get over three draws:

 > cumsum(table(res[2,])/R)
     1      2      3      4      5      6 
0.3006 0.7910 0.9653 0.9968 0.9999 1.0000 

By your definition, you have $16$ cards ($10$, $\text{J}$, $\text{K}$, $\text{Q}$) that are worth $10$ points, so with probability $16/52$ you get $10$ points in a single draw. Since $9+\text{anything}=10$, then if we take into consideration that there is $4$ nines, than we instantly know that with probability greater than $20/52$ you finish in two draws. However, return of two draws is simple to obtain by enumerating all $52 \choose 2$ combinations of card pairs and summing their scores.

unique_cards <- c(1:10, 10, 10, 10)  # A, 1, 2, ..., 10, J, Q, K
unique_cards <- rep(unique_cards, 4) # each appears 4 times

comb <- combn(unique_cards, 2) # take all possible combinations of card pairs

what gives $79\%$ probability of obtaining score of at least $10$ in two draws

> sum(colSums(comb) >= 10)/choose(52, 2) # accepted / all combinations
[1] 0.7888386

Lazy solution for more than two draws can be obtained by a simple simulation, where whole deck is shuffled and then cards are drawn until their total score is at least $10$.

set.seed(123)
    
sim <- function(target = 10) {
  res <- cumsum(sample(unique_cards)) # shuffle, draw and sum
  n <- which.max(res >= target)       # take first score >= 10
  c(sum = res[n], n = n)
}

R <- 1e4
res <- replicate(R, sim())

and the result is that on average you have to draw two cards and the average total score is $12.77$

> apply(res, 1, summary)
          sum     n
Min.    10.00 1.000
1st Qu. 10.00 1.000
Median  12.00 2.000
Mean    12.77 1.946
3rd Qu. 15.00 2.000
Max.    19.00 6.000

Moreover, as expected, with approximately $30\%$ probability you finish with one draw, but with $79\%$ probability you finish with two draws and you rarely get over three draws:

 > cumsum(table(res[2,])/R)
     1      2      3      4      5      6 
0.3006 0.7910 0.9653 0.9968 0.9999 1.0000 
deleted 45 characters in body
Source Link
Tim
  • 141.2k
  • 26
  • 270
  • 512

By your definition, you have $16$ cards ($10$, $\text{J}$, $\text{K}$, $\text{Q}$) that are worth $10$ points, so with probability $16/52$ you get $10$ points in a single draw. Since $9+\text{anything}=10$, then if we take into consideration that there is $4$ nines, than we instantly know that with probability greater than $20/52$ you finish in two draws. However, return of two draws is simple to obtain by enumerating all combinations of cards and summing their scores. Since order of drawing cards does not matter, we can take only the upper diagonal of the there is $52 \times 52$ table of all the$52 \choose 2$ possible combinations of card pairs:

unique_cards <- c(1:10, 10, 10, 10)  # A, 1, 2, ..., 10, J, Q, K
unique_cards <- rep(unique_cards, 4) # each appears 4 times

outcomb <- matrixcombn(0, 52unique_cards, 52)

for (i in 1:51)
  for(j in i:522)
   # take all out[i,j]possible <-combinations unique_cards[i]of +card unique_cards[j]pairs
> sum(outcolSums(comb) >= 10)/(sumchoose(1:52) -, 12)
[1] 0.78503997888386

By your definition, you have $16$ cards ($10$, $\text{J}$, $\text{K}$, $\text{Q}$) that are worth $10$ points, so with probability $16/52$ you get $10$ points in a single draw. Since $9+\text{anything}=10$, then if we take into consideration that there is $4$ nines, than we instantly know that with probability greater than $20/52$ you finish in two draws. However, return of two draws is simple to obtain by enumerating all combinations of cards and summing their scores. Since order of drawing cards does not matter, we can take only the upper diagonal of the $52 \times 52$ table of all the possible combinations of card pairs:

unique_cards <- c(1:10, 10, 10, 10)  # A, 1, 2, ..., 10, J, Q, K
unique_cards <- rep(unique_cards, 4) # each appears 4 times

out <- matrix(0, 52, 52)

for (i in 1:51)
  for(j in i:52)
      out[i,j] <- unique_cards[i] + unique_cards[j]
> sum(out >= 10)/(sum(1:52) - 1)
[1] 0.7850399

By your definition, you have $16$ cards ($10$, $\text{J}$, $\text{K}$, $\text{Q}$) that are worth $10$ points, so with probability $16/52$ you get $10$ points in a single draw. Since $9+\text{anything}=10$, then if we take into consideration that there is $4$ nines, than we instantly know that with probability greater than $20/52$ you finish in two draws. However, return of two draws is simple to obtain by enumerating all combinations of cards and summing their scores. Since order of drawing cards does not matter there is $52 \choose 2$ possible combinations of card pairs:

unique_cards <- c(1:10, 10, 10, 10)  # A, 1, 2, ..., 10, J, Q, K
unique_cards <- rep(unique_cards, 4) # each appears 4 times

comb <- combn(unique_cards, 2) # take all possible combinations of card pairs
> sum(colSums(comb) >= 10)/choose(52, 2)
[1] 0.7888386
added 158 characters in body
Source Link
Tim
  • 141.2k
  • 26
  • 270
  • 512

By your definition, you have $16$ cards ($10$, $\text{J}$, $\text{K}$, $\text{Q}$) that are worth $10$ points, so with probability $16/52$ you get $10$ points in a single draw. Since $9+\text{anything}=10$, then if we take into consideration that there is $4$ nines, than we instantly know that with probability greater than $20/52$ you finish in two draws. However, return of two draws is simple to obtain by enumerating all combinations of cards and summing their scores. Since order of drawing cards does not matter, we can take only the upper diagonal of the $52 \times 52$ table of all the possible combinations of card pairs:

By your definition, you have $16$ cards ($10$, $\text{J}$, $\text{K}$, $\text{Q}$) that are worth $10$ points, so with probability $16/52$ you get $10$ points in a single draw. Since $9+\text{anything}=10$, then if we take into consideration that there is $4$ nines, than we instantly know that with probability greater than $20/52$ you finish in two draws. However, return of two draws is simple to obtain by enumerating all combinations of cards and summing their scores:

By your definition, you have $16$ cards ($10$, $\text{J}$, $\text{K}$, $\text{Q}$) that are worth $10$ points, so with probability $16/52$ you get $10$ points in a single draw. Since $9+\text{anything}=10$, then if we take into consideration that there is $4$ nines, than we instantly know that with probability greater than $20/52$ you finish in two draws. However, return of two draws is simple to obtain by enumerating all combinations of cards and summing their scores. Since order of drawing cards does not matter, we can take only the upper diagonal of the $52 \times 52$ table of all the possible combinations of card pairs:

added 79 characters in body
Source Link
Tim
  • 141.2k
  • 26
  • 270
  • 512
Loading
added 111 characters in body
Source Link
Tim
  • 141.2k
  • 26
  • 270
  • 512
Loading
added 563 characters in body
Source Link
Tim
  • 141.2k
  • 26
  • 270
  • 512
Loading
Source Link
Tim
  • 141.2k
  • 26
  • 270
  • 512
Loading