cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A363058 Number of ways to get n points in a bridge hand.

Original entry on oeis.org

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

Views

Author

Jud McCranie, May 16 2023

Keywords

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.)

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