Le 4 mai 2021, la plateforme Yahoo Questions/Réponses fermera. Elle est désormais accessible en mode lecture seule. Aucune modification ne sera apportée aux autres sites ou services Yahoo, ni à votre compte Yahoo. Vous trouverez plus d’informations sur l'arrêt de Yahoo Questions/Réponses et sur le téléchargement de vos données sur cette page d'aide.
Can you define a numbering system for these combinations?
There are 27 slots into which go 9 identical balls.
There are 27!/(18!*9!) = 4686825 ways to fit the balls into the slots.
Number the slots 1 to 27 (or any other numbers you prefer.)
Let n1, n2, n3,...n9 be the numbers of the occupied slots and n1 < n2 < n3 < ... < n9.
Make a formula or routine using the numbers of the 9 occupied slots so that each combination has a unique identifying number from 1 to 4686825 (or 0 to 4686824 if you like.)
Preferably the combination with the balls in the first nine slots on the left has number 1 and the combination with the balls in the nine slots on the right is identified by number 4686825.
If you make a routine, it should be one with which the number can be calculated quickly, and not by counting all the combinations up to that position.
Hey paolo, Thanks for your input, but I don't understand. How will the number be different if all the balls are together on the left from the number if all the balls are together on the right or all together anywhere in between? The spaces between the balls are all zero in each case.
Also which configuration gives the number 1?
This question is about 27_C_9. It's taking 9 numbers from the numbers 1 to 27.
Each ball is in a different slot.
Of the nine numbers, n1, n2, n3...,n9 we know n1< n2<n3...<n9.
27_C_9 = 4686825. The task is assign a unique identifying number from 1 to 4686825 to each combination of 27 take 9. Preferably this is done with a formula that can fit into an excel sheet cell.
The floor function is fine.
Thanks for all the responses. I have house guests this weekend so I won't have a chance to study these until Monday or Tuesday.
paulo, I noticed with your first answer with base 19 all the numbers are multiples of 18. I divided by 18 and got 1 through 18. Then it started skipping numbers. I had to start subtracting triangle numbers. I'll follow this later.
Thanks, Manjyome! This is just what I need.
Can you say how you came to this formula?
It is interesting that excel cannot calculate C(n, n+1), but an If statement takes care of that.
I also find it interesting that your method progresses by choosing the next combination with the balls bunched as far to the left as
possible.
I was investigating base 19 divided by 18 as paulo suggested at first and stepping the right side balls across to the right. Perhaps
someone will find an expression for how many triangular numbers need to be subtracted from this method.
I'm going to leave this question open a bit longer. Good comments are still coming in after you posted your formula.
5 réponses
- Mugen is StrongLv 7il y a 1 décennieRéponse favorite
unique numbers
= 1 + C(n1 - 1 , 1) + C(n2 - 1 , 2) + C(n3 - 1 , 3) + C(n4 - 1 , 4) + C(n5 - 1 , 5) + C(n6 - 1 , 6) + C(n7 - 1 , 7) + C(n8 - 1 , 8) + C(n9 - 1 , 9)
number 1 is 111111111000000000000000000 and number 4686825 is 000000000000000000111111111.
n1 is at the leftmost (as n9 is at the rightmost) and for any C(n,r) with n < r, it is 0.
the formula for x balls within y slots is
= 1 + ΣC(n_i - 1 , i) , with i = [1,x] and n_i = [1,y]
- rozeta53Lv 6il y a 1 décennie
Let the permutation be
a[27] a[26] a[25] . . . a[3] a[2] a[1],
where a[i]=0 or a[i]=1.
Let the number of '1' be 9.
Let k be a non-negative integer, such that:
1) 0<=k<=9
2) for i=1 to k, all a[i]=1
3) a[k+1]=0
Then the unique identifying number N of each permutation will be:
N=1+∑ [i=k+1 to 27] a[i]*(i-1)!/{u[i]!*(i-1-u[i])!}
where u[i] is the number of '1' from a[1] to a[i]
It's easy to write a computer program based on the above logic.
If I have time, I'll try to write it.
Edit:
Examples:
a) 000000000000000011101110111
k=3
N=1+10!/(9!1!)+9!/(8!1!)+8!/(7!1!)+
6!/6!+5!/5!+4!/4!=31
b) 100010001000100010001001110
k=0
N=1+26!/(9!17!)+22!/(8!14!)+
18!/(7!11!)+14!/(6!8!)+10!/(5!5!)+
6!/(4!2!)+3!/3!+2!/2!+1!/1!
c) 111111111000000000000000000
k=0
N=26!/(9!17!)+25!/(8!17!)+24!/(7!17!)+
23!/(6!17!)+22!/(5!17!)+21!/(4!17!)+
20!/(3!17!)+19!/(2!17!)+18!/(1!17!)+1=
4686825
- il y a 1 décennie
Try this:
Let the number of slots be n, in this instance, 27, and the number of balls be k, in this instance, 9. Let the position p in your combinatorial "number" be zero for the least significant digit and k−1 for the most significant. The least significant number will represent the position of the highest ball, the next least significant be the next highest, and so on. Each digit in this representation will be to the base d(p−1)+1, where d(p) is the digit in position p. d(0) is in base n−k. To generate the number:
1. Set your number accumulator be zero.
2. For p = 0 to k−1 do:
3. If m is the position of the (p+1)'th highest ball, set the digit at position p to m−k+p. If this digit is zero, you may optionally stop early and return the contents of the accumulator because all less significant digits will also be zero.
4. Next p.
5. Return the contents of the accumulator.
The p'th digit of this representation is in base d(p−1)+1, where d(p) is the digit in position p. Position zero in is in base n−k. To decode this number:
1. Set the accumulator to zero.
2. For p = k−1 to 1 do:
3. Set the base counter b to d(p−1)+1
4. Multiply the accumulator by b and add d(p).
5. Next p.
6. Set the base counter b to n−k.
7. Multiply the accumulator by b and add d(0)
8. Return the contents of the accumulator.
- jordanLv 4il y a 1 décennie
i had deleted all.
---
now the question are clear, thanks.
i'll present my algorithm.
if you'll understand it then you realized that it is based on the identity sum_{i=0}^{t} {(n+i over n)} = (n+t+1 over n+1), for any positive integers n and t fixed.
you have (27 over 9) combinations. it's ok.
consider those number in base 2, so they are composed of nine numbers 1 and eighteen numbers 0, randomly.
now we can assign (by bjiection) each of those number to a number x in the intervall [1, (27 over 9)].
we need to proceed like that to construct x:
- start with 1.
CASE A
if the first digit in base 2 is 1 then you dont need to add anything;
- if the second digit is 0 then you must add the number of possibe numbers which starts by (1,1) which are (25 over 7);
- if the second digit is 1 then you dont need to add anything.
CASE B
otherwise the first digit is 0, so you must add the number of possible numbers which starts by 1 (so it is (26 over 9)):
- of the second digit is 1 then you dont add anything;
- if the second digit is 0 then you must add the number of possibl numbers which starts by (0,1) which are (25 over 8)..
and so on..
it is important to understand the meaning of the binomial coefficient...we can prove that this algorith generate effectively a bjiection: in fact we can start from the image, e.g. the number 10000.
so we need to proceed like that:
(10000-1)<(26 over 9) so the first digit is 1(in base 2).
(10000-1)<(25 over 8) so the second digit is 1.
(10000-1)<(24 over 7) so the third digit is 1.
(10000-1)<(23 over 6) so it is again 1.
(10000-1)<(22 over 5) so it is again 1.
(10000-1)>(21 over 4) so the sixth digit is 0. so we need to delete the (21 over 4) itself.
(10000-1-(21over 4)) =4014<(20 over 4) so we have a 1.
4014 > (19 over 3) so we have a 0 and we must consider the number 4014-(19 over 3)= 3045.
and so on, the process is unique, so it is unique also te number in base 2 and the associated combination of 9 balls in27 slots.
cheers
paolo.
- ?Lv 4il y a 5 ans
Database: a complete decision of appropriate documents prepared for handy get entry to, frequently in a working laptop or computing gadget. table:an affiliation of words, numbers, or signs and indicators, or mixtures of them, as in parallel columns, to demonstrate a sequence of data or relatives in a distinctive, compact, and complete form; a synopsis or scheme. form:a checklist with sparkling areas to be crammed in with info in the previous it relatively is accomplished: a tax form. question:a question; an inquiry. checklist:an account or assertion describing intimately an journey, difficulty, or the like, oftentimes by using fact the consequence of commentary, inquiry, and so on.: a checklist on the peace convention; a scientific checklist on the affected person. conventional Key: one in each and every of various achievable attributes or mixtures of attributes that would properly be utilized to uniquely perceive a physique of know-how