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.

This page as a plain text file.
%I A363058 #29 Oct 19 2023 06:28:00
%S A363058 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,
%T A363058 24,21,21,17,16,13,11,8,6,3,2,1
%N A363058 Number of ways to get n points in a bridge hand.
%C A363058 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.)
%e A363058 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.
%o A363058 (R)
%o A363058 card_values <- c(
%o A363058   Ace = 4,
%o A363058   King = 3,
%o A363058   Queen = 2,
%o A363058   Jack = 1
%o A363058 )
%o A363058 combinations <- function(n) {
%o A363058   count <- 0
%o A363058   for (a in 0:4) {
%o A363058     for (k in 0:4) {
%o A363058       for (q in 0:4) {
%o A363058         for (j in 0:4) {
%o A363058           if (a + k + q + j <= 13 &&
%o A363058               a * card_values['Ace'] + k * card_values['King'] + q * card_values['Queen'] + j * card_values['Jack'] == n) {
%o A363058             count <- count + 1
%o A363058           }
%o A363058         }
%o A363058       }
%o A363058     }
%o A363058   }
%o A363058   return(count)
%o A363058 }
%o A363058 results_vector <- c()
%o A363058 for (n in 1:37) {
%o A363058   output <- combinations(n)
%o A363058   if (output > 0) {
%o A363058     results_vector <- c(results_vector, output)
%o A363058   }
%o A363058 }
%o A363058 format_output <- paste(results_vector, collapse = ", ")
%o A363058 cat(format_output)
%o A363058 # _W. Kyle Hamilton_, Oct 01 2023
%o A363058 (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};
%o A363058 for (n=1,37, print1(a363058(n),", ")) \\ _Hugo Pfoertner_, Oct 01 2023
%Y A363058 Cf. A309777.
%K A363058 nonn,fini,full
%O A363058 1,2
%A A363058 _Jud McCranie_, May 16 2023