# 5 card car dealer math/logic problem for any number of cards

Remember the old 5 card car dealer math/logic problem? Goal: get the lowest markup possible

5 cards - each has an unknown base amount plus a multiple of 100 ranged as base+0,base+100,base+200,base+300,base+400 When a card is flipped up you can either keep that amount or discard it and draw again but must settle on 1 card of the 5. What is the average result for best decision practices?

Solving for the general solution instead of just the 5 card solution: --- treating the additional numbers (0,100,etc) as multiples (0,1,2,etc.) of 100 ---

My old notes for my general solution were:

Observations (with 5 card solution already calculated)

A five card game for card B is

{B}={1[a-4],2[a-3],3[a-2],4[a-1],4[a+1],3[a+2],2[a+3],1[a+4]}

with n(n-1) elements=20

A four card game

{B}={[a-3],2[a-2],3[a-1],3[a+1],2[a+2],[a+3]}

with 12 elements

A three card game

{B}={[a-2],2[a-1],2[a+1],[a+2]}

with 6 elements

3 cards is the low limit of informed decisions - 2 cards would be pure random

All subsets follow the same pattern.

{Xn}={[lowest],2[second lowest],...(n-1)[largest on low side], --- and mirrored on the high side to [highest]}

Notes:

# cards=n Min=0 Max=n-1

The lower half set is limited by a-Max=0 and a-1=Max-1

The upper half set is limited by a+1=1 and a+Max=Max

A 3 CARD GAME

Cards A,B,C

A is a random of the three and averages to 1

{A}={0,1,2}=3/3=1 Min=[a-2]=0 Max=[a+2]=2

If you draw card B the possible values for B are A-2,A-1,A+1,A+2

{B}={[a-2],2[a-1],2[a+1],[a+2]}

if B=A-2 it must be B=0, A=2, and C will be 1

so you keep B=0 every time and we know that [a-2]=0

{B}={0}{2[a-1,2[a+1],[a+2]}

if B=A+2 then A=0,B=2, and C=1 so always draw C and [a+2]=1

{B}={0,1}{2[a-1],2[a+1]}

if B=A-1 we might have xBA or BAx, B is either 0 or 1 average 0.5 and C is either 0 or 2 average 1 so we keep B making the average result for [a-1] = 0.5

{B}={0,1}{0.5,0.5}{2[a+1]}

if B=A+1 ( xAB or ABx ), B is 2 or 1 average 1.5, C is 0 or 2 average 1, so draw C making the average value of [a+1]=1

{B}={0,1}{0.5,0.5}{1,1}=4/6=6[2/3]

A 4 CARD GAME

B={,2,3[0.5],3,2,}=12[5/8]

4 card procedural:

{B}={[a-3],2[a-2],3[a-1],3[a+1],2[a+2],[a+1]}

if B=A-3 BxxA B=0 [a-3]=0, if B=A+3 AxxB draw to [a+3]=[a+1]=1

{B}={0,1}{2[a-2],3[a-1],3[a+1],2[a+2]}

if B=A-2 xBxA BxAx B={1,0} C={0,2}{1,3}=4[2/3] [a-2]=2[0.5]={0,1}

------invalidating straight substitution of the 3 card set [a-2]=0 value------

{B}={0,1,0.5,0.5}{3[a-1],3[a+1],2[a+2]}

if B=A+2 xAxB AxBx B={3,2}=2.5 C={0,2,1,3}=1.5 draw C

if C=A-1 CAxB C=0 stop, if C=A+3 AxBC draw D=1

{C}={0,1}{2,1}

if C=A+1 xACB ACBx C={3,2}=2.5 D={0,3}=1.5 draw D

{C}={0,1,1.5,1.5}=1

{B}={0,1,0.5,0.5,1,1}{3[a-1],3[a+1]}

if B=A-1 xxBA xBAx BAxx B={2,1,0}=1 C={0,1,0,3,2,3}=1.5 keep B

{B}={0,1,0.5,0.5,1,1}{1,1,1}{3[a+1]}

if B=A+1 xxAB xABx ABxx B={3,2,1}=2 C={0,1,0,3,2,3}=1.5 draw C

{C}= {[a-2],2[a-1],2[a+2],[a+3]}

if C=A-2 CxAB C=0, if C=A+3 ABxC draw D=2

{C}={0,2}{2[a-1],2[a+2]}

if C=A-1 xCAB CABx C=(1,0}=0.5 D=(0,3}=1.5 keep C

{C}={0,2,0.5,0.5}{2[a+2]}

if C=A+2 xABC ABCx C={3,2}=2.5 draw D={0,3}=1.5

{C}={0,2,0.5,0.5,1.5,1.5}=1

{B}={0,1,0.5,0.5,1,1}{1,1,1}{1,1,1}=12[10/12]

and we already know a 5 card game comes to .9 and is a 20 element set for the AB combinations

Note:

each smaller set is a subset of the next larger card set where Card A = Max or 0 in the larger set

so the 3 card {B3}={[a-2],2[a-1],2[a+1],[a+2]} in terms of the 4 card set

{B4}={[a-3],2[a-2],3[a-1],3[a+1],2[a+2],[a+1]} gives us a 3 card subset of

{B4.3}={[a-3],2[a-2],2[a+2],[a+1]} and the 4 card set is

{B4}={3[a-1],3[a+1]}{B4.3}

Same pattern next level up {B5}={4[a-1],4[a+1]}{B5.4}

and we see that {Bn}={(n-1)[a-1],(n-1)[a+1]}{Bn.n-1}

{(n-1)[a-1],(n-1)[a+1]} is a set of 2 equally weighted subsets each with n-1 elements

[a-1]=n-2,[a+1]=1 for the Bn.n-1 subset

[a-1]=(n-1)[1/(n-1)] , [a+1]=(n-1)[(n-2)/(n-1)] = 2(n-1)

each subset for Bn combines (2n-2) with the Bn.n-1 set

(add 2n-2 to numerator and denominator and element count)

beginning with the {B3}={0,1,1,0}=4[2/4] set

so if {B3}=2/3 ( actually 6[4/6] ) then

{B4}=(6*2/3+8-2)/(6+8-2)=10/12

and {B5}=18/20, {B6}=28/30, {B7}=40/42, {B8}=54/56

looking at the sets again we see the obvious pattern

and the entire sequence reduces to

Bn = (n(n-1)-2) / n(n-1) where n > 2

Cards and final score

1 : 0 (= 0.0) ==> 1 ={0}

2 : 1/2 (= 0.5) ==> 4[2/4] = {0,1}{1,0} = {0,1,1,0}

3 : 2/3 (= 0.6667) ==> 6[4/6] = {0,1,1,1,1,0}

4 : 5/6 (= 0.8333) = 12[10/12] = {0,1,1,1,1,1,1,1,1,1,1,0}

5 : 9/10 (= 0.9) = 20[18/20] = {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0}

6 : 14/15 or actually 28/30

and a set of 100 cards would be 9898/9900

There must be a formal method of mathematical notation to express this - does anyone know what that would be? I was just making a notational method up on the fly but I believe the logic is correct. Note by Wayne Mathias
3 years, 5 months ago

This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.

When posting on Brilliant:

• Use the emojis to react to an explanation, whether you're congratulating a job well done , or just really confused .
• Ask specific questions about the challenge or the steps in somebody's explanation. Well-posed questions can add a lot to the discussion, but posting "I don't understand!" doesn't help anyone.
• Try to contribute something new to the discussion, whether it is an extension, generalization or other idea related to the challenge.

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold
- bulleted- list
• bulleted
• list
1. numbered2. list
1. numbered
2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in $$ ... $$ or $ ... $ to ensure proper formatting.
2 \times 3 $2 \times 3$
2^{34} $2^{34}$
a_{i-1} $a_{i-1}$
\frac{2}{3} $\frac{2}{3}$
\sqrt{2} $\sqrt{2}$
\sum_{i=1}^3 $\sum_{i=1}^3$
\sin \theta $\sin \theta$
\boxed{123} $\boxed{123}$