Probability Puzzle

john's Avatar

john

23 Feb, 2024 10:02 AM

Just for fun I used NodeBox to answer the following puzzle, posed on Quora:

There is a game where you draw 7 numbers. In total there are 36 numbers, which are six ones, six twos, six threes, till six sixes. What are the chances for you to draw a sum of numbers greater or equal to 26?

This is a bit tricky to figure out. There are 36 choose 7 = 8,347,680 different ways of drawing those 7 numbers (where the order of the 7 numbers doesn't matter). Those 7 numbers can wind up in 786 different forms that sum to totals ranging from 8 to 41. For any one of these forms there are many different ways of drawing the pattern.

For example, if you draw four 2s, two 3s, and a 4 the total sums to 18. But there are 6 choose 4 = 15 different ways of drawing four 2s from the six 2s available. And 15 ways of drawing two of the six 3s. And 6 different 4s you could draw. So there are 15 x 15 x 6 = 1350 different ways of drawing that 2222334 pattern.

This puzzle gave me a chance to use MANY of my library nodes including:

  • n_choose_k
  • distribution
  • concat_list
  • products
  • percentage
  • change_col
  • draw_table

The final answer is there are 3,388,062 different ways of drawing numbers that sum to 26 or more, for an overall chance of 40.5869%

Solving puzzles like this is what I call a PONARV, a Project Of No Apparent Redeeming Value. It demonstrates that Nodebox is not just for drawing pictures; you can also use it to think carefully through tricky math problems. Most importantly, I enjoyed making it!

Screenshot and code attached.

John

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • puzzle26_screenshot.png 982 KB
  • puzzle26.zip 301 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

10 Sep, 2024 03:41 AM
09 Sep, 2024 02:15 PM
07 Sep, 2024 05:16 AM
05 Sep, 2024 02:21 AM
04 Sep, 2024 05:01 AM

 

03 Sep, 2024 10:07 AM
02 Sep, 2024 05:56 AM
31 Aug, 2024 11:07 PM
27 Aug, 2024 12:08 AM
26 Aug, 2024 01:02 PM
26 Aug, 2024 07:18 AM