All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
An enumeration problem (Posted on 2019-01-28) Difficulty: 3 of 5
In how many distinct ways one can divide 5 black
and 5 white beads into piles?

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Let me enumerate the ways -- computer solution Comment 1 of 1
We may decide to include or exclude the degenerate case of leaving one pile with all 5 black beads and all 5 white beads. It will be easiest to consider the possibilities of different numbers of piles separately. That brings up the question of whether a pile can have just one bead and still be considered a pile; I will assume you can have a pile with just one bead.

It's also the case that the piles don't have identities; they are not numbered boxes, so black beads in piles of 1, 2 and 2 is no different from being in piles of 2, 2 and 1. And if black beads occupy just three piles but white beads occupy four, there could be seven piles all together, or any number down to just four.

The hard part is combining the two lists; so much so, that I think the idea of separate lists is not a good idea, actually.

So, I think the best method is a recursive computer algorithm that reduces the number of available black and white beads as it creates piles, with number of white beads nested in a loop varying the number of black beads.

In the list below, each pile is represented by two digits, the first of which is the number of black beads and the second is the number of white beads.  The piles are listed in numeric order treating these as two-digit numbers.

 01 01 01 01 01 10 10 10 10 10
 01 01 01 01 01 10 10 10 20
 01 01 01 01 01 10 10 30
 01 01 01 01 01 10 20 20
 01 01 01 01 01 10 40
 01 01 01 01 01 20 30
 01 01 01 01 01 50
 01 01 01 01 10 10 10 10 11
 01 01 01 01 10 10 10 21
 01 01 01 01 10 10 11 20
 01 01 01 01 10 10 31
 01 01 01 01 10 11 30
 01 01 01 01 10 20 21
 01 01 01 01 10 41
 01 01 01 01 11 20 20
 01 01 01 01 11 40
 01 01 01 01 20 31
 01 01 01 01 21 30
 01 01 01 01 51
 01 01 01 02 10 10 10 10 10
 01 01 01 02 10 10 10 20
 01 01 01 02 10 10 30
 01 01 01 02 10 20 20
 01 01 01 02 10 40
 01 01 01 02 20 30
 01 01 01 02 50
 01 01 01 10 10 10 10 12
 01 01 01 10 10 10 11 11
 01 01 01 10 10 10 22
 01 01 01 10 10 11 21
 01 01 01 10 10 12 20
 01 01 01 10 10 32
 01 01 01 10 11 11 20
 01 01 01 10 11 31
 01 01 01 10 12 30
 01 01 01 10 20 22
 01 01 01 10 21 21
 01 01 01 10 42
 01 01 01 11 11 30
 01 01 01 11 20 21
 01 01 01 11 41
 01 01 01 12 20 20
 01 01 01 12 40
 01 01 01 20 32
 01 01 01 21 31
 01 01 01 22 30
 01 01 01 52
 01 01 02 10 10 10 10 11
 01 01 02 10 10 10 21
 01 01 02 10 10 11 20
 01 01 02 10 10 31
 01 01 02 10 11 30
 01 01 02 10 20 21
 01 01 02 10 41
 01 01 02 11 20 20
 01 01 02 11 40
 01 01 02 20 31
 01 01 02 21 30
 01 01 02 51
 01 01 03 10 10 10 10 10
 01 01 03 10 10 10 20
 01 01 03 10 10 30
 01 01 03 10 20 20
 01 01 03 10 40
 01 01 03 20 30
 01 01 03 50
 01 01 10 10 10 10 13
 01 01 10 10 10 11 12
 01 01 10 10 10 23
 01 01 10 10 11 11 11
 01 01 10 10 11 22
 01 01 10 10 12 21
 01 01 10 10 13 20
 01 01 10 10 33
 01 01 10 11 11 21
 01 01 10 11 12 20
 01 01 10 11 32
 01 01 10 12 31
 01 01 10 13 30
 01 01 10 20 23
 01 01 10 21 22
 01 01 10 43
 01 01 11 11 11 20
 01 01 11 11 31
 01 01 11 12 30
 01 01 11 20 22
 01 01 11 21 21
 01 01 11 42
 01 01 12 20 21
 01 01 12 41
 01 01 13 20 20
 01 01 13 40
 01 01 20 33
 01 01 21 32
 01 01 22 31
 01 01 23 30
 01 01 53
 01 02 02 10 10 10 10 10
 01 02 02 10 10 10 20
 01 02 02 10 10 30
 01 02 02 10 20 20
 01 02 02 10 40
 01 02 02 20 30
 01 02 02 50
 01 02 10 10 10 10 12
 01 02 10 10 10 11 11
 01 02 10 10 10 22
 01 02 10 10 11 21
 01 02 10 10 12 20
 01 02 10 10 32
 01 02 10 11 11 20
 01 02 10 11 31
 01 02 10 12 30
 01 02 10 20 22
 01 02 10 21 21
 01 02 10 42
 01 02 11 11 30
 01 02 11 20 21
 01 02 11 41
 01 02 12 20 20
 01 02 12 40
 01 02 20 32
 01 02 21 31
 01 02 22 30
 01 02 52
 01 03 10 10 10 10 11
 01 03 10 10 10 21
 01 03 10 10 11 20
 01 03 10 10 31
 01 03 10 11 30
 01 03 10 20 21
 01 03 10 41
 01 03 11 20 20
 01 03 11 40
 01 03 20 31
 01 03 21 30
 01 03 51
 01 04 10 10 10 10 10
 01 04 10 10 10 20
 01 04 10 10 30
 01 04 10 20 20
 01 04 10 40
 01 04 20 30
 01 04 50
 01 10 10 10 10 14
 01 10 10 10 11 13
 01 10 10 10 12 12
 01 10 10 10 24
 01 10 10 11 11 12
 01 10 10 11 23
 01 10 10 12 22
 01 10 10 13 21
 01 10 10 14 20
 01 10 10 34
 01 10 11 11 11 11
 01 10 11 11 22
 01 10 11 12 21
 01 10 11 13 20
 01 10 11 33
 01 10 12 12 20
 01 10 12 32
 01 10 13 31
 01 10 14 30
 01 10 20 24
 01 10 21 23
 01 10 22 22
 01 10 44
 01 11 11 11 21
 01 11 11 12 20
 01 11 11 32
 01 11 12 31
 01 11 13 30
 01 11 20 23
 01 11 21 22
 01 11 43
 01 12 12 30
 01 12 20 22
 01 12 21 21
 01 12 42
 01 13 20 21
 01 13 41
 01 14 20 20
 01 14 40
 01 20 34
 01 21 33
 01 22 32
 01 23 31
 01 24 30
 01 54
 02 02 10 10 10 10 11
 02 02 10 10 10 21
 02 02 10 10 11 20
 02 02 10 10 31
 02 02 10 11 30
 02 02 10 20 21
 02 02 10 41
 02 02 11 20 20
 02 02 11 40
 02 02 20 31
 02 02 21 30
 02 02 51
 02 03 10 10 10 10 10
 02 03 10 10 10 20
 02 03 10 10 30
 02 03 10 20 20
 02 03 10 40
 02 03 20 30
 02 03 50
 02 10 10 10 10 13
 02 10 10 10 11 12
 02 10 10 10 23
 02 10 10 11 11 11
 02 10 10 11 22
 02 10 10 12 21
 02 10 10 13 20
 02 10 10 33
 02 10 11 11 21
 02 10 11 12 20
 02 10 11 32
 02 10 12 31
 02 10 13 30
 02 10 20 23
 02 10 21 22
 02 10 43
 02 11 11 11 20
 02 11 11 31
 02 11 12 30
 02 11 20 22
 02 11 21 21
 02 11 42
 02 12 20 21
 02 12 41
 02 13 20 20
 02 13 40
 02 20 33
 02 21 32
 02 22 31
 02 23 30
 02 53
 03 10 10 10 10 12
 03 10 10 10 11 11
 03 10 10 10 22
 03 10 10 11 21
 03 10 10 12 20
 03 10 10 32
 03 10 11 11 20
 03 10 11 31
 03 10 12 30
 03 10 20 22
 03 10 21 21
 03 10 42
 03 11 11 30
 03 11 20 21
 03 11 41
 03 12 20 20
 03 12 40
 03 20 32
 03 21 31
 03 22 30
 03 52
 04 10 10 10 10 11
 04 10 10 10 21
 04 10 10 11 20
 04 10 10 31
 04 10 11 30
 04 10 20 21
 04 10 41
 04 11 20 20
 04 11 40
 04 20 31
 04 21 30
 04 51
 05 10 10 10 10 10
 05 10 10 10 20
 05 10 10 30
 05 10 20 20
 05 10 40
 05 20 30
 05 50
 10 10 10 10 15
 10 10 10 11 14
 10 10 10 12 13
 10 10 10 25
 10 10 11 11 13
 10 10 11 12 12
 10 10 11 24
 10 10 12 23
 10 10 13 22
 10 10 14 21
 10 10 15 20
 10 10 35
 10 11 11 11 12
 10 11 11 23
 10 11 12 22
 10 11 13 21
 10 11 14 20
 10 11 34
 10 12 12 21
 10 12 13 20
 10 12 33
 10 13 32
 10 14 31
 10 15 30
 10 20 25
 10 21 24
 10 22 23
 10 45
 11 11 11 11 11
 11 11 11 22
 11 11 12 21
 11 11 13 20
 11 11 33
 11 12 12 20
 11 12 32
 11 13 31
 11 14 30
 11 20 24
 11 21 23
 11 22 22
 11 44
 12 12 31
 12 13 30
 12 20 23
 12 21 22
 12 43
 13 20 22
 13 21 21
 13 42
 14 20 21
 14 41
 15 20 20
 15 40
 20 35
 21 34
 22 33
 23 32
 24 31
 25 30
 55
 
339 269   70 done

Meaning there are 339 ways, but 269 of these involve at least one "pile" that is only a single bead, leaving 70 that consist solely of piles, strictly speaking.

DefDbl A-Z
Dim crlf$, pile(10), blackremain, whiteremain, tot, totsingle

Private Sub Form_Load()
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 
 blackremain = 5: whiteremain = 5
 addOn 1
 
 Text1.Text = Text1.Text & crlf & tot & Str(totsingle) & "   " & tot - totsingle & " done"
End Sub

Sub addOn(wh)
  If wh = 1 Then blackstart = 0 Else blackstart = pile(wh - 1) \ 10
  For black = blackstart To blackremain
    blackremain = blackremain - black
    
    For white = 0 To whiteremain
     DoEvents
      whiteremain = whiteremain - white
      
      pile(wh) = 10 * black + white
      If pile(wh) > 0 And pile(wh) >= pile(wh - 1) Then
        If blackremain = 0 And whiteremain = 0 Then
          oneOnly = 0
          For i = 1 To wh
            Text1.Text = Text1.Text & Format(pile(i), " 00")
            If pile(i) = 1 Or pile(i) = 10 Then oneOnly = 1
          Next
          Text1.Text = Text1.Text & crlf
          tot = tot + 1
          If oneOnly Then totsingle = totsingle + 1
        Else
          addOn wh + 1
        End If
      End If
    
      whiteremain = whiteremain + white
    Next white
    
    blackremain = blackremain + black
  Next black
End Sub


  Posted by Charlie on 2019-01-28 15:58:38
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (15)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information