login
A363058
Number of ways to get n points in a bridge hand.
2
1, 2, 3, 5, 5, 8, 9, 12, 13, 16, 17, 21, 21, 24, 25, 28, 27, 30, 29, 31, 29, 30, 27, 28, 25, 24, 21, 21, 17, 16, 13, 11, 8, 6, 3, 2, 1
OFFSET
1,2
COMMENTS
The most common way of evaluating a bridge hand (13 cards from a standard deck) is to count a jack as 1 point, a queen as 2 points, a king as 3 points, and an ace as 4 points, and add them together. (Suits are ignored.)
EXAMPLE
a(2)=2 because you can have a total of 2 points in two ways: two jacks or one queen, and a(3)=3 because you can have a total of 3 points in three ways: one king, one queen plus one jack, or three jacks.
PROG
(R)
card_values <- c(
Ace = 4,
King = 3,
Queen = 2,
Jack = 1
)
combinations <- function(n) {
count <- 0
for (a in 0:4) {
for (k in 0:4) {
for (q in 0:4) {
for (j in 0:4) {
if (a + k + q + j <= 13 &&
a * card_values['Ace'] + k * card_values['King'] + q * card_values['Queen'] + j * card_values['Jack'] == n) {
count <- count + 1
}
}
}
}
}
return(count)
}
results_vector <- c()
for (n in 1:37) {
output <- combinations(n)
if (output > 0) {
results_vector <- c(results_vector, output)
}
}
format_output <- paste(results_vector, collapse = ", ")
cat(format_output)
# W. Kyle Hamilton, Oct 01 2023
(PARI) a363058(n) = {my (c=0); for (a=0, 4, for (k=0, 4, for (q=0, 4, for (j=0, 4, if (a+k+q+j<=13 && 4*a+3*k+2*q+j==n, c++))))); c};
for (n=1, 37, print1(a363058(n), ", ")) \\ Hugo Pfoertner, Oct 01 2023
CROSSREFS
Cf. A309777.
Sequence in context: A152771 A325711 A306676 * A341122 A237825 A194939
KEYWORD
nonn,fini,full
AUTHOR
Jud McCranie, May 16 2023
STATUS
approved