Re: Possible results from three variables
- From: "bakpao@xxxxxxxxx" <bakpao@xxxxxxxxx>
- Date: Thu, 12 Jul 2007 23:22:01 -0000
On Jul 13, 8:23 am, Robert Israel
<isr...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
"Karl-Olav Nyberg" <konyb...@xxxxxxxxx> writes:
<bak...@xxxxxxxxx> skrev i melding
news:1184225137.530634.258440@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Given three variables, say x, y, z with each variable being an integer
from 1 to 10, how many possible values are there from the equation of
x * y * z? The quickest and incorrect answer is 1000 (from 10x10x10).
This is wrong because some of the combinations actually the same, e.g.
1*2*4 = 1*4*2 = 4*1*2 = 1*8*1. Doing 10C3 is also wrong.
Is there any formula that we can use to find out the number of
possibilities for the different integer range (e.g. 1 - 5 or 1 - 8)?
In Maple:
a:= n -> nops({seq(seq(seq(x*y*z,x=1..n),y=1..n),z=1..n)});
Hi.
(1*2*3*4*5*6*7*8*9*10) / (1*2*3*1*2*3*4*5*6*7) = 120
Generally: (n!) / (m! * (n-m)!)
It's a coincidence that (10 choose 3) is the right answer. For integers
1 to 11 the answer would be 173, not (11 choose 3) = 165.
See sequence A027425 in the On-Line Encyclopedia of Integer Sequences,
<http://www.research.att.com/~njas/sequences/A027425>. I don't think
there's a closed form for a(n) or a closed form generating function or
recurrence.
--
Robert Israel isr...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia Vancouver, BC, Canada V6T 1Z2
Thanks for the replies.
Here are a few comments:
1. The numbers can be the same, there is no restriction.
2. quasi: that is a very interesting pattern you have there!
3. Stephen J. Herschkorn: that is also what I had in mind but it is
very slow. I was hoping for a simple formula to obtain it.
It seems there is no existing proven formula for this. But that's OK
since brute force seems to be sufficient to find out the answer.
Thanks for your help guys!
Just for reference I have created a simple C# function that does brute
force search on it:
public void Solve()
{
Hashtable solution = new Hashtable();
int max = 10;
for (int x = 1; x <= max; x++)
{
for (int y = 1; y <= max; y++)
{
for (int z = 1; z <= max; z++)
{
solution[x * y * z] = 1;
}
}
}
MessageBox.Show(solution.Keys.Count.ToString());
}
.
- Follow-Ups:
- Re: Possible results from three variables
- From: mensanator@xxxxxxxxxxx
- Re: Possible results from three variables
- References:
- Possible results from three variables
- From: bakpao@xxxxxxxxx
- Re: Possible results from three variables
- From: Karl-Olav Nyberg
- Re: Possible results from three variables
- From: Robert Israel
- Possible results from three variables
- Prev by Date: Book advice
- Next by Date: Re: Possible results from three variables
- Previous by thread: Re: Possible results from three variables
- Next by thread: Re: Possible results from three variables
- Index(es):
Relevant Pages
|