Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2016-06-19 21:14:24

gra0001
Member
Registered: 2015-08-10
Posts: 10

Combinations within a Subset of Combinations

Hi, looking for a person to program or maybe use VBA in Excel to Solve something.
Lets say I have 12 Numbers 1 to 12, so there are 495 sets of 4 combinations
Sample: Using this link (below) and Selecting 12 numbers and 4 numbers to choose
Is Order important?= No    Is Repetition allowed?=No
https://www.mathsisfun.com/combinatorics/combinations-permutations-calculator.html

Now I want to list the minimum number of 6 number sets that contain the 4 number combinations
Manually I worked out I could do it in 42 sets of 6 numbers that contained all 495 combinations
That is we would have all the 4 combinations in a set of 6 numbers of the 12 numbers.
I don’t know what you call this Subsets?
EG The 12 Numbers are 1,2,3,4,5,6,7,8,9,10,11,12
There are 495 combinations of 4 numbers
-In say 1,2,3,4,5,6 (6 Numbers) there are 15 Combinations of 4
(1,2,3,4)(1,2,3,5)(1,2,3,6)(1,2,4,5)(1,2,4,6)(1,2,5,6)(1,3,4,5)(1,3,4,6)(1,3,5,6)(1,4,5,6)(2,3,4,5)(2,3,4,6)(2,3,5,6)(2,4,5,6)(3,4,5,6)
-In say 1,2,3,7,8,9 (6 Numbers) there are 15 combinations of 4
(1,2,3,7)(1,2,3,8)(1,2,3,9)(1,2,7,9)(1,2,8,9)(1,3,7,8)(1,3,8,9)(1,7,8,9)(2,3,7,8)(2,3,7,9)(2,7,8,9)(3,7,8,9)(1,3,7,9)(2,3,8,9)(1,2,7,8)
So in 42 Lines of sets of 6 number combinations I created a list that contain all 495 combinations of 4
42 Lines was the minimum,  and I believe the sets of 6 was balanced because I used each number in the set of 6 numbers 21 times each

The Program I need is:
Enter the Total number of Numbers EG 12 (But can be any number to 50)
Enter the Total number used in each SET EG 6 (But can be any number to 10)
Enter the Total number of Combinations to cover EG 4 (But can be any number to 10)
Then display 2 things:
-The string of the 6 Numbers (1 Row for every set of 6 numbers)
-All the Combinations of 4 and what row they appear in (for error checking)
-Note: It needs to be done in the Minimum of Rows of 6 numbers
Yes some duplication of obtain the 4 combinations may happen as it did in my 42 set of 6

Offline

#2 2016-06-20 01:14:17

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Combinations within a Subset of Combinations

Hi;

The person that knows exactly what you want all the time is you, have you thought about programming this yourself?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#3 2016-06-20 02:46:11

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 25,002
Website

Re: Combinations within a Subset of Combinations

Why does it have to be in excel?


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#4 2016-06-20 11:24:15

gra0001
Member
Registered: 2015-08-10
Posts: 10

Re: Combinations within a Subset of Combinations

Can be written in anything!
I could try but I don't know what the terms are
Trust me I have looked and looked for examples
Thought I would ask here, as I always use the www link to create the "combinations"

I have an Excel that I use that displays where the 4 combinations are found in the 6 numbers
And at the end I export a CSV file of the 6 numbers

Last edited by gra0001 (2016-06-20 11:26:23)

Offline

#5 2016-06-20 17:22:37

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Combinations within a Subset of Combinations

It would have to be in some language that you can run later.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#6 2016-06-21 04:09:29

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 25,002
Website

Re: Combinations within a Subset of Combinations

Are you asking a program that has the following input and output?

Input: A set S, a natural r
Output: All possible subsets of S containing exactly r elements


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

#7 2016-06-21 11:32:33

gra0001
Member
Registered: 2015-08-10
Posts: 10

Re: Combinations within a Subset of Combinations

Probably best if I could email the Excel I created manually to show you
My brain hurts, but I "think" you may have it nailed
The trick is to have ALL the 4 Combinations contained in minimum of 6 numbers
Some 4 combinations will appear more than once but that has to be.

Last edited by gra0001 (2016-06-21 11:34:30)

Offline

#8 2016-06-21 15:16:26

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 25,002
Website

Re: Combinations within a Subset of Combinations

Do you use python?


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

Board footer

Powered by FluxBB