login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A363058 Number of ways to get n points in a bridge hand. 2

%I #29 Oct 19 2023 06:28:00

%S 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 24,21,21,17,16,13,11,8,6,3,2,1

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

%C 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 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 (R)

%o card_values <- c(

%o Ace = 4,

%o King = 3,

%o Queen = 2,

%o Jack = 1

%o )

%o combinations <- function(n) {

%o count <- 0

%o for (a in 0:4) {

%o for (k in 0:4) {

%o for (q in 0:4) {

%o for (j in 0:4) {

%o if (a + k + q + j <= 13 &&

%o a * card_values['Ace'] + k * card_values['King'] + q * card_values['Queen'] + j * card_values['Jack'] == n) {

%o count <- count + 1

%o }

%o }

%o }

%o }

%o }

%o return(count)

%o }

%o results_vector <- c()

%o for (n in 1:37) {

%o output <- combinations(n)

%o if (output > 0) {

%o results_vector <- c(results_vector, output)

%o }

%o }

%o format_output <- paste(results_vector, collapse = ", ")

%o cat(format_output)

%o # _W. Kyle Hamilton_, Oct 01 2023

%o (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 for (n=1,37, print1(a363058(n),", ")) \\ _Hugo Pfoertner_, Oct 01 2023

%Y Cf. A309777.

%K nonn,fini,full

%O 1,2

%A _Jud McCranie_, May 16 2023

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 28 12:00 EDT 2024. Contains 375507 sequences. (Running on oeis4.)