Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Looking for a mathematical formula

Looking for a mathematical formula

Scheduled Pinned Locked Moved The Lounge
tutorialquestion
9 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    __yash__
    wrote on last edited by
    #1

    Its about combinations. If I have 4 cards and I need to select 2 cards out of them then it can be done in 4C2 ways i.e. 4!/[2!(4-2)!] i.e. 6 ways. Now I have been trying to map a formula to find out exactly how many number of times will each card get touched in these 6 combinations. In this particular example each card gets touched 3 times. Is there any formula that already exists for this purpose? If you are going to nuke it saying it doesn't belong in the Lounge then consider it a puzzle ;P

    A R V N C 5 Replies Last reply
    0
    • _ __yash__

      Its about combinations. If I have 4 cards and I need to select 2 cards out of them then it can be done in 4C2 ways i.e. 4!/[2!(4-2)!] i.e. 6 ways. Now I have been trying to map a formula to find out exactly how many number of times will each card get touched in these 6 combinations. In this particular example each card gets touched 3 times. Is there any formula that already exists for this purpose? If you are going to nuke it saying it doesn't belong in the Lounge then consider it a puzzle ;P

      A Offline
      A Offline
      Abhinav S
      wrote on last edited by
      #2

      __yash__ wrote:

      If you are going to nuke it saying it doesn't belong in the Lounge then consider it a puzzle

      This kind of question does belong to the Lounge so you are ok. Now if you had said you needed code for this problem, you might have seen different sort of responses. :)

      The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it. My latest tip/trick

      1 Reply Last reply
      0
      • _ __yash__

        Its about combinations. If I have 4 cards and I need to select 2 cards out of them then it can be done in 4C2 ways i.e. 4!/[2!(4-2)!] i.e. 6 ways. Now I have been trying to map a formula to find out exactly how many number of times will each card get touched in these 6 combinations. In this particular example each card gets touched 3 times. Is there any formula that already exists for this purpose? If you are going to nuke it saying it doesn't belong in the Lounge then consider it a puzzle ;P

        R Offline
        R Offline
        Roger Wright
        wrote on last edited by
        #3

        It's a good puzzle! :-D Unfortunately, I've been away from school for 30 years and I forgot the answer. But let me know when you find an answer. I have a similar problem that should be simple, but I think I keep making it too hard by worrying it like a dog with a big bone. I live amidst 9 casinos, and all have electronic Keno games. Each machine offers different versions of the game, each with it's own payout schedule for picking 3 to 20 spots. I want to write a simple program to calculate the best odds, not of winning, but of increasing my holdings. On some machines you can win often, but the payout is so low you still get eaten alive. On others the odds of hitting a mark are low, but the payout is so high that it only takes one to do well. I want to generate a table of bets that optimize my chances of walking out with my shirt and pants, given the inputs of # spots selected, # spots hit, and the payout in multiples of the bet amount. I'm embarrassed to admit that I've forgoten the formula for this, as once I knew it well enough to get an 'A' grade in the class. If I can create such a function, I can run it in a loop and accumulate the results for each selection and see which strategy is likely to generate the most income (or least loss).

        Will Rogers never met me.

        1 Reply Last reply
        0
        • _ __yash__

          Its about combinations. If I have 4 cards and I need to select 2 cards out of them then it can be done in 4C2 ways i.e. 4!/[2!(4-2)!] i.e. 6 ways. Now I have been trying to map a formula to find out exactly how many number of times will each card get touched in these 6 combinations. In this particular example each card gets touched 3 times. Is there any formula that already exists for this purpose? If you are going to nuke it saying it doesn't belong in the Lounge then consider it a puzzle ;P

          V Offline
          V Offline
          virang_21
          wrote on last edited by
          #4

          Well I just run some combination and looks like if you have to chose 2 cards from n cards will have nC2 different combination. If you look at the number of combination every card comes (n-1) times. For 4 cards 1 2 3 4 there will be 1 2 1 3 1 4 2 3 2 4 3 4 are the possible combination as you can see card no 1 is there 3 times, card no 2 us there 3 times and so on . it looks like (n-1) times it is repeating. this is true for only 2 card selection I haven't tried this on selecting more than 2 cards. Office time is about to over . 5 min to go !!

          Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.

          _ 1 Reply Last reply
          0
          • V virang_21

            Well I just run some combination and looks like if you have to chose 2 cards from n cards will have nC2 different combination. If you look at the number of combination every card comes (n-1) times. For 4 cards 1 2 3 4 there will be 1 2 1 3 1 4 2 3 2 4 3 4 are the possible combination as you can see card no 1 is there 3 times, card no 2 us there 3 times and so on . it looks like (n-1) times it is repeating. this is true for only 2 card selection I haven't tried this on selecting more than 2 cards. Office time is about to over . 5 min to go !!

            Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.

            _ Offline
            _ Offline
            __yash__
            wrote on last edited by
            #5

            Been there, done that!! :) Its pretty straight forward for selecting 2 from N but gets more involved when trying for more than 2. I have been drawing weird diagrams and after having seen "A Beautiful Mind" I thought I should get it just looking at the numbers ;P I disappoint myself :doh:

            G 1 Reply Last reply
            0
            • _ __yash__

              Its about combinations. If I have 4 cards and I need to select 2 cards out of them then it can be done in 4C2 ways i.e. 4!/[2!(4-2)!] i.e. 6 ways. Now I have been trying to map a formula to find out exactly how many number of times will each card get touched in these 6 combinations. In this particular example each card gets touched 3 times. Is there any formula that already exists for this purpose? If you are going to nuke it saying it doesn't belong in the Lounge then consider it a puzzle ;P

              N Offline
              N Offline
              Nagy Vilmos
              wrote on last edited by
              #6

              Sounds like an Algorithms[^] question to me...


              Panic, Chaos, Destruction. My work here is done. or "Drink. Get drunk. Fall over." - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre

              1 Reply Last reply
              0
              • _ __yash__

                Its about combinations. If I have 4 cards and I need to select 2 cards out of them then it can be done in 4C2 ways i.e. 4!/[2!(4-2)!] i.e. 6 ways. Now I have been trying to map a formula to find out exactly how many number of times will each card get touched in these 6 combinations. In this particular example each card gets touched 3 times. Is there any formula that already exists for this purpose? If you are going to nuke it saying it doesn't belong in the Lounge then consider it a puzzle ;P

                C Offline
                C Offline
                cp9876
                wrote on last edited by
                #7

                Number of ways of choosing m from n is nCm. The number of times a particular card is used (touched) is (n-1)C(m-1). In case this is homework I'll leave the explanation to you.

                Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

                _ 1 Reply Last reply
                0
                • C cp9876

                  Number of ways of choosing m from n is nCm. The number of times a particular card is used (touched) is (n-1)C(m-1). In case this is homework I'll leave the explanation to you.

                  Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

                  _ Offline
                  _ Offline
                  __yash__
                  wrote on last edited by
                  #8

                  cp9876 wrote:

                  The number of times a particular card is used (touched) is (n-1)C(m-1).

                  I tried this formula on a few cases and it seems to be working. Thanks :)

                  1 Reply Last reply
                  0
                  • _ __yash__

                    Been there, done that!! :) Its pretty straight forward for selecting 2 from N but gets more involved when trying for more than 2. I have been drawing weird diagrams and after having seen "A Beautiful Mind" I thought I should get it just looking at the numbers ;P I disappoint myself :doh:

                    G Offline
                    G Offline
                    Gandalf_TheWhite
                    wrote on last edited by
                    #9

                    __yash__ wrote:

                    drawing weird diagrams and after having seen "A Beautiful Mind"

                    btw... are you able to see that little girl after using your mind for such things!! ;P

                    Believe Yourself™

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups