# How to find the Circular permutation with Repetition [duplicate]

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?

-