You are not logged in.

- Topics: Active | Unanswered

**gAr****Member**- Registered: 2011-01-09
- Posts: 3,462

For k colors with n marbles each, I find it to be:

May require some modification when number of marbles are different.

*Last edited by gAr (2013-04-27 22:53:23)*

"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense" - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 81,472

Hi gAr;

That is a nice one, it will come in handy.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

**gAr****Member**- Registered: 2011-01-09
- Posts: 3,462

Hi,

Got a recursion to work!

Here's a sage code:

```
A = 10
B = 10
C = 10
D = 10
def f(a,b,c,d):
if (A-a == 2 or B-b == 2 or C-c == 2 or D-d == 2):
return (A+B+C+D-(a+b+c+d))
return a/Integer(a+b+c+d)*f(a-1,b,c,d) + b/Integer(a+b+c+d)*f(a,b-1,c,d) + c/Integer(a+b+c+d)*f(a,b,c-1,d) + d/Integer(a+b+c+d)*f(a,b,c,d-1)
print f(A,B,C,D)
```

It returns : 30008/9139

"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense" - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 81,472

Hi gAr;

Yeparoo! Very good!

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

**gAr****Member**- Registered: 2011-01-09
- Posts: 3,462

Yeah, that looks much neater than the formula!

I think this will help in many problems involving probability..

"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense" - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 81,472

Hi;

Have you tried the formula in post#26 on this problem?

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

**gAr****Member**- Registered: 2011-01-09
- Posts: 3,462

Yes, and we must multiply that by 2, I forgot to include that.

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 81,472

I am not getting the correct answer then, when I multiply by 2 I get:

I am using n = 10 and k = 4.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

**gAr****Member**- Registered: 2011-01-09
- Posts: 3,462

Perhaps I made a mistake when translating my program to the formula? Or you took out n from the sum ?

Here's the code I used:

```
def ans(n,k):
summ = 0
for i in range(1,k+1):
pr = 1
for j in range(1,i):
pr *= (k-j)*n/Integer(4*n-j)
summ += (i)*(i+1)/2 * pr * (n-1)/Integer(4*n-i)
return 2*summ
```

ans(10,4) returns 30008/9139

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 81,472

Hi;

Why the Integer() command?

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

**gAr****Member**- Registered: 2011-01-09
- Posts: 3,462

It causes problem like flooring if it's not written..

In python, we need to convert it to float.

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 81,472

Hi;

There is a typo in the formula. In post #26 there is (k-i), in post #34, (k-j).

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

**Pearl2013****Member**- Registered: 2013-04-27
- Posts: 6

Oop answer was wrong

Offline

**gAr****Member**- Registered: 2011-01-09
- Posts: 3,462

Hi bobbym,

Ah yes, sorry!

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 81,472

No problem! Thank you for the formula.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

**gAr****Member**- Registered: 2011-01-09
- Posts: 3,462

You're welcome!

I think we can't write a formula like that when the number of marbles are different for different colors, since it involves permutation?

Anyway, I'll stop here, spent almost a day on this one!

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 81,472

Hi;

I will play with it a little in a bit. Right now there is a little bit of an administrative matter to watch for.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

**gAr****Member**- Registered: 2011-01-09
- Posts: 3,462

Okay..

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 81,472

Hi;

Looks like the worst is over. Now about that formula...

If we hold k = 4 and vary n then we come up with this:

for n = 2, 3, 4, ...

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

**gAr****Member**- Registered: 2011-01-09
- Posts: 3,462

That's a good one!

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 81,472

Oh yes and quite useless unless you have exactly 4 colors.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

**gAr****Member**- Registered: 2011-01-09
- Posts: 3,462

Anyway, we can easily extend the recursion if not the formula for any number of variables and experiment with the terms.

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 81,472

There are a lot of possibilities here.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline

**gAr****Member**- Registered: 2011-01-09
- Posts: 3,462

Yes.

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 81,472

Hi;

I am going to get a little sleep. See you later.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

Offline