Here's an easy math riddle!

Discussion in 'Chit Chat' started by wonder, Jun 17, 2015.

  1. wonder

    wonder Expert Licensed User

    You own a small cocktail bar with 8 different bottles:

    - Vodka
    - Gin
    - Rum
    - Whiskey
    - Tequila
    - Martini
    - Mango Juice
    - Cola

    You need to come up with the menu for the grand opening tonight.
    How many different cocktails would you be able to create with your shaker? ;)

    For this problem, each cocktail may only contain 2 drinks.
    Also, remember that a drink mixed with itself is not a cocktail.
     
    Last edited: Jun 18, 2015
  2. sorex

    sorex Expert Licensed User

    (8^8)-8 ? 56
     
  3. sorex

    sorex Expert Licensed User

    or will you mix with 3 or more aswell? (then it's still too early to thing about that ;) )
     
  4. wonder

    wonder Expert Licensed User

    I forgot to mention, you only pairs, 2 drinks per cocktail. :D

    Nope, not 56.
     
  5. eurojam

    eurojam Well-Known Member Licensed User

    7+6+5+4+3+2+1

    now I am drunk .... after having 28 drinks...:confused:
     
  6. Eumel

    Eumel Active Member Licensed User

    28
     
    wonder likes this.
  7. GKCS

    GKCS Member Licensed User

    is 10% Gin with 90% Martini the same Cocktail than 90% Gin with 10% Martini?

    My guess is ENDLESS possibilities ...
     
  8. thedesolatesoul

    thedesolatesoul Expert Licensed User

  9. LucaMs

    LucaMs Expert Licensed User

    I do not participate: I am a teetotaler :p
     
  10. LucaMs

    LucaMs Expert Licensed User

    56 is not right, because it is:

    8 * 7! / (7-6)! = 56

    but it is "recursive":

    7 * 6! / (6-5)!
    ...
     
  11. LucaMs

    LucaMs Expert Licensed User

    You have forgotten, I read now :confused:
     
  12. wonder

    wonder Expert Licensed User

    CORRECT!! Well done!
    The answer is [((n^2 + n) / 2) - n] which is 28. :)
    Why? Because a Whiskey-Cola is the same as a Cola-Whiskey. ;)


    It was based on this kind of logic that I built my new collision detector.

    Old code:

    Code:
    Dim number_of_characters = 256 as Int 'Originally as Boolean (ahahah, thx Informatix)
    Dim Collision(256256as Boolean

    For host = 0 to (number_of_characters - 1)
        
    For guest = 0 to (number_of_characters - 1)
            Collision(host, guest) = CheckCollision(host, guest)
        
    Next
    Next

    'Number of Collision Checks: 65536

    My new method:
    Code:
    Dim number_of_characters = 256 as Int 'Originally as Boolean (ahahah, thx Informatix)
    Dim Collision(256256as Boolean

    For host = 0 to (number_of_characters - 1)
        
    For guest = host + 1 to (number_of_characters - 1)
            Collision(host, guest) = CheckCollision(host, guest)
            Collision(guest, host) = Collision(host, guest)
        
    Next
    Next

    'Number of Collision Checks: 32640

    For more on this subject, Google: Triangular Numbers
     
    Last edited: Jun 21, 2015
  13. sorex

    sorex Expert Licensed User

    actually it's not always the case, some drinks are forbidden to be shaken because the stuff isn't supposed to mix and are floating on top of each other.

    so if you have whiskey-cola it will taste different than cola-whiskey because you get the other stuff in your mouth first ;)
     
  14. sorex

    sorex Expert Licensed User

    why not (N^2-n)/2 ?
     
    ilan likes this.
  15. thedesolatesoul

    thedesolatesoul Expert Licensed User

    I think the real derivation comes from:
    n*(n-1)/2
     
    ilan likes this.
  16. udg

    udg Well-Known Member Licensed User

    Probably I'm wrong, but I reached the same correct result applying [n! / (n-k)!] /2 that derives from what in Italian is called "Disposizioni semplici", where "n" are the objects and "k" are the elements put together. Final division accounts for couples like Gin-Rum / Rum-Gin.

    udg
     
    thedesolatesoul and JordiCP like this.
  17. JordiCP

    JordiCP Well-Known Member Licensed User

    I think the general formula is n!/[(n-k)!*k!]

    Where the k! plays the same role as the "2" but with k elements (for k=3 --> k!=3.2=6 --> Gin-Rum-Vodka , Gin-Vodka-Rum, Rum-Gin-Vodka, Rum-Vodka-Gin, Vodka-Rum-Gin, Vodka-Gin-Rum )
     
    udg and thedesolatesoul like this.
  18. derez

    derez Expert Licensed User

    R1 over R2 : (in this case 8 over 2)
    Code:
    Dim mul As Int = 1
    For i = 1 To R2
       mul = mul * ((R1+
    1-i)/i)
    Next
    result = mul
     
  19. LucaMs

    LucaMs Expert Licensed User


    In addition, some combinations are disgusting :D
     
  20. Informatix

    Informatix Expert Licensed User

    256 as boolean ???
     
    ilan likes this.
Loading...