probability of playing music player on shuffle and listening to every song.

I have a few problems I am trying to work out but I am not totally confident in my answers:

The problem is such: Suppose you have a playlist consisting of four songs. You play your playlist in shuffle mode. In this mode, after the current song is played, the next song is chosen randomly from the other three tracks. This ensures you never hear the same song twice in a row.Let X be the number of songs you listen to until you've heard all the four different songs.

1.How many sequences of 4 songs are there where no song plays twice in a row? If we label the songs {A, B, C, D}, then examples are ABCD and ABAB but not ABBA.

For this problem I just thought the answer was (4^4) = 256 Does this make sense?

2. I have to find the value of P(X=4). to do this I used the formula n!/(n^n) because (n^n) is the possible sequences of n songs, and because the possible sequence of n songs including every song is n!.

So my answer was: P(X=4) = 24/254 = 3/32


I am trying to understand really how this problem works, and I would like some more insight as to if these answers make sense/ how I should be tackling a problem like this. How would I compute problems like these?

Any help is appreciated.

• "In this mode, after the current song is played, the next song is chosen randomly from the other four tracks. " Did you mean the other three tracks? – Sidd Singal Apr 13 '14 at 23:47
• yes sorry I will edit that – userunknown Apr 13 '14 at 23:48
• Your first answer (4^4) isn't right, it includes things like AAAA for example. – rVitale Apr 13 '14 at 23:49
• I think I sketched an answer to this (general case) a couple of weeks ago. Of course, finding is pretty hopeless. – André Nicolas Apr 13 '14 at 23:51