Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Possible Duplicate:
In how many ways we can put $r$ distinct objects into $n$ baskets?

Need some guidance with the following problem : There are 'n' different types of objects which needs to be placed in a circle of length 'r' , such that no two adjacent items are of the same type. Repetition is allowed.

eg. n = 4 {a,b,c,d} and r = 3 , the circular permutations are 
a b c
a b d
a c b
a c d
a d b
a d c
b c d
b d c

We do not include a permutation like 'b d a' , since that is the same as 'a b d'. Nor do we include a permutation like 'a a d' or 'a d a' since they do not satisfy the adjacency condition.

Similarly for n = 4 {a,b,c,d} and r = 4, 'a b a b' is valid, but 'a b b c' is not.

Is there a general solution or method that I can follow to solve this problem?

share|improve this question

marked as duplicate by joriki, Rudy the Reindeer, Henry T. Horton, Matt Pressland, Chris Eagle Oct 4 '12 at 15:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Same question was asked and answered recently. It has been asked a few times in the last couple of days, Same problem, same source. –  André Nicolas Oct 2 '12 at 9:20

1 Answer 1

up vote 0 down vote accepted

Yes, it is.

There is a good article about combinations and variations in codeproject. You need for "Combinations (i.e., without Repetition)" there.

Also if you familar with C# you can use simple and short solution from stackoverflow.

share|improve this answer
    
Thanks , got it.. –  Kyuubi Oct 2 '12 at 9:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.