A363058 Number of ways to get n points in a bridge hand.
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
Examples
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.
Crossrefs
Cf. A309777.
Programs
-
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
-
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
Comments