Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Math Topics » discretemath

Topic: A combinatorial problem
Replies: 2   Last Post: Oct 2, 2011 1:59 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Edu59

Posts: 4
Registered: 9/1/11
A combinatorial problem
Posted: Oct 1, 2011 9:07 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi:
I am trying to solve this mathematical problem with an unknown matlab built-in function.
Let K=1?20 be the set of the first 20 integers. Consider all combinations of 5 elements selected from the set K. How many of these combinations contain elements that differ by 3?
For example, the combination (1,4,5,9,15) has elements 1 and 4 whose difference is 4-1=3 but the combination (1,2,3,9,15) has no elements that differ by 3. So the combination (1,4,5,9,15) is one I am looking for and the combination (1,2,3,9,15) is not. What is the total number of combinations like (1,4,5,9,15) taken from the first 20 integers.?
I tried the following procedure:
With the built-in matlab function combntns I can enumerate the combinations of n objects taken p at a time and then I can use the function size to calculate the total number of combinations for example:


How can the numbers 1 to 5 be taken in sets of three (that is, what is 5 choose 3)?
combos = combntns(1:5,3)
combos =
1 2 3
1 2 4
1 2 5
1 3 4
1 3 5
1 4 5
2 3 4
2 3 5
2 4 5
3 4 5
size(combos,1) % "5 choose 3"
ans =
10


Is there a matlab function that enumerates combinations with elements that differ by 3 and then use a function like size to compute the total number of combinations.?
Thank you in advance.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.