## Search found 18 matches

- Sat Aug 20, 2016 10:21 am
- Forum: Combinatorics
- Topic: Urns and balls
- Replies:
**0** - Views:
**6853**

### Urns and balls

We have some urns (u1 u2 u3 u4) with different number of red and black balls (r1 b1), (r2 b2)... and we select one ball from each 1.The number of ways to get all 4 balls red is r1*r2*r3*r4 . 2.The number of ways to have 3 reds and 1 black is r1*r2*r3*b4 +r1*r2*b3*r4+r1*b2*r3*r4+b1*r2*r3*r4. 3.The nu...

- Thu Oct 01, 2015 1:48 pm
- Forum: Combinatorics
- Topic: Sum of products of n-tuples
- Replies:
**3** - Views:
**8637**

### Re: Sum of products of n-tuples

jaap wrote:Isn't it just this?Expand

Expand

- Thu Oct 01, 2015 9:53 am
- Forum: Combinatorics
- Topic: Sum of products of n-tuples
- Replies:
**3** - Views:
**8637**

### Sum of products of n-tuples

Let's say I have an array of numbers {a,b,c,d,e} and want to calculate the sum of product of all triples abc+abd+...+cde. I can calculate it very fast without generating all triples using this formula F(n,k)= v[k]*F(n-1, k-1)+ F(n-1, k) with two loops int[] values={a, b, c, d, e...}; int k = 3; int[...

- Wed May 28, 2014 11:47 am
- Forum: Combinatorics
- Topic: Set containing max number of subsets
- Replies:
**11** - Views:
**9486**

### Re: Set containing max number of subsets

Thank You jaap. The idea was from a lottery game (keno). There are 80 numbers [1..80] and are selected randomly 20 numbers. A player can select 1 to 8 numbers. If the player's numbers are all included in the 20 he wins. There are N players that have selected some sets with 1<=size<=8. The task is to...

- Tue May 27, 2014 7:25 am
- Forum: Combinatorics
- Topic: Set containing max number of subsets
- Replies:
**11** - Views:
**9486**

### Re: Set containing max number of subsets

I tried starting from empty set, adding subset A, then B, A∪B, C , A∪C, B∪C , A∪B∪C, D ... removing duplicates(same unions with same number of subsets) and those with size >20.

This can work for a few subsets, but the list grows rapidly.

Checking each of 100!/(80!*20!) subsets is impossible also.

This can work for a few subsets, but the list grows rapidly.

Checking each of 100!/(80!*20!) subsets is impossible also.

- Sun May 25, 2014 3:31 pm
- Forum: Combinatorics
- Topic: Set containing max number of subsets
- Replies:
**11** - Views:
**9486**

### Re: Set containing max number of subsets

Doesn't have every set of size n have the same number of subsets? (2^n) Yes. I mean we have some (not all) singles, doubles, triples, 4-uples and 5-uples {1} , {25}, {2,30}, {1,2,3}, {3, 20, 50}, {40,50,60,70}, {1,2,3,4,5} ...(they are less than Cnk(100, 1)+Cnk(100, 2)+Cnk(100, 3)+Cnk(100, 4)+Cnk(1...

- Sun May 25, 2014 12:45 pm
- Forum: Combinatorics
- Topic: Set containing max number of subsets
- Replies:
**11** - Views:
**9486**

### Set containing max number of subsets

Let's say we have the set of numbers [1..100] and some subsets with size<=5.

{1} , {25}, {2,30}, {1,2,3}, {3, 20, 50}, {40,50,60,70}, {1,2,3,4,5}....

Is it some efficient method to find a set of size=20 το contain the most sets?

{1} , {25}, {2,30}, {1,2,3}, {3, 20, 50}, {40,50,60,70}, {1,2,3,4,5}....

Is it some efficient method to find a set of size=20 το contain the most sets?

- Sun Dec 29, 2013 5:26 pm
- Forum: Number
- Topic: Limit average speed using delays
- Replies:
**0** - Views:
**2046**

### Limit average speed using delays

Hello, This question is more mathematical than programmatical (althougth I wrote quite enough code :D ), so I decided to post it here. I have an application that reads data from the web and I want to implement a speed limit feature The program gets the stream in packets inside a while loop until has...

- Tue Sep 17, 2013 7:55 pm
- Forum: Number
- Topic: An priority algorithm
- Replies:
**2** - Views:
**2225**

### Re: An priority algorithm

I want to implement an IncreasePriority algorithm that takes as arguments a collection of elements ( e.g. IncreasePriority of 25th, 35th, and 37th elements). Thank you. Can't you just call the single-element version several times, once for each element in your collection? The only thing to be caref...

- Tue Sep 17, 2013 6:28 pm
- Forum: Number
- Topic: An priority algorithm
- Replies:
**2** - Views:
**2225**

### An priority algorithm

I have an int[N] array, each element has a unique value 1 to N. I want to implement a IncreasePriority function (add 1 to the selected element and remove 1 to the element that had that value, so all elements have unique values). Increasing priority of a single element is easy. Add 1 (if is less than...

- Fri Nov 23, 2012 8:15 am
- Forum: Combinatorics
- Topic: Maximising sum of products
- Replies:
**4** - Views:
**4592**

### Re: Maximising sum of products

I think this can be a possible PE problem

Expand

- Thu Nov 22, 2012 9:47 pm
- Forum: Combinatorics
- Topic: Maximising sum of products
- Replies:
**4** - Views:
**4592**

### Re: Maximising sum of products

Thank you both kevinsogo and thundre.

You helped me a lot.

You helped me a lot.

- Thu Nov 22, 2012 11:21 am
- Forum: Combinatorics
- Topic: Maximising sum of products
- Replies:
**4** - Views:
**4592**

### Maximising sum of products

Lets say we have x1, x2 ...x n and y1,y2, ...yn all >0. I want to maximize the sum of pair products (i.e. x1*y2+x4*y1 +x2*y3+...) Since there are n! combinations we cannot find all sums. Is there some efficient method to find the first k (k=10 or 100) bigest sums? If I sort X and Y , taking the prod...

- Tue Aug 28, 2012 2:09 pm
- Forum: Clarifications on Project Euler Problems
- Topic: Problem 295
- Replies:
**7** - Views:
**2408**

### Re: Problem 295

Both sides >1 ?

- Tue Aug 28, 2012 11:39 am
- Forum: Clarifications on Project Euler Problems
- Topic: Problem 295
- Replies:
**7** - Views:
**2408**

### Re: Problem 295

Continuing with the same reasoning I count:

- for N=10 --> 31 shapes and 30 distinct pairs.

for N=100 --> 3330 shapes and less than 3330 distinct pairs.

- Sat Jul 07, 2012 7:42 pm
- Forum: Clarifications on Project Euler Problems
- Topic: Problem 283
- Replies:
**7** - Views:
**3068**

### Re: Problem 283

Hello,

For (area/perimeter) <=

Thank You.

For (area/perimeter) <=

**100**is sum of the perimeters 289620027474 ?Thank You.

- Sun May 09, 2010 10:17 pm
- Forum: Clarifications on Project Euler Problems
- Topic: Problem 288
- Replies:
**14** - Views:
**5522**

### Re: Problem 288

Yes, i get this too: NF(61,10^6) mod 61^9 = 1075175834078238

Maybe you have same problem with me.

If you are using

long m = (long) Math.Pow(61,10) // gives m= 713342911662882560 !!!!

check this :

61^9 = 11694146092834141

61^10=713342911662882601

Maybe you have same problem with me.

If you are using

long m = (long) Math.Pow(61,10) // gives m= 713342911662882560 !!!!

check this :

61^9 = 11694146092834141

61^10=713342911662882601

- Wed Sep 30, 2009 7:16 am
- Forum: Clarifications on Project Euler Problems
- Topic: Problem 257
- Replies:
**7** - Views:
**3240**

### Problem 257

Hi, can anyone confirm for (a+b+c<=10000) number of triangles is 7677

Thank you!

Thank you!