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.

  • $\begingroup$ "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? $\endgroup$ – Sidd Singal Apr 13 '14 at 23:47
  • $\begingroup$ yes sorry I will edit that $\endgroup$ – userunknown Apr 13 '14 at 23:48
  • $\begingroup$ Your first answer (4^4) isn't right, it includes things like AAAA for example. $\endgroup$ – rVitale Apr 13 '14 at 23:49
  • $\begingroup$ I think I sketched an answer to this (general case) a couple of weeks ago. Of course, finding is pretty hopeless. $\endgroup$ – André Nicolas Apr 13 '14 at 23:51

I think for your number 1. The first song can be 4 different songs, right? Now how about the second song. The second song can be exactly 3 other songs, because you can't choose the same song twice. Same with the 3rd and fourth songs. That gives you 4*3*3*3 different possible choices (which equals like 108 I think).

For number 2, you did the right thing, but just replace the number from number 1.

  • $\begingroup$ Thank you. For part 2, you say replace the number for part 1? Should it be 4!/108? Or does that formula that I have work? $\endgroup$ – userunknown Apr 13 '14 at 23:58
  • $\begingroup$ @userunknown It should be over 108 because your question implies that it is not possible for the same song to play twice in a row, and so we can't include song sequences like AAAA in the possible total number of sequences. $\endgroup$ – Sidd Singal Apr 14 '14 at 0:00
  • $\begingroup$ yes, but if I were to then calculate P(x=5) for example, that would mean I would do something like 5!/108 which is a probability larger than 1. $\endgroup$ – userunknown Apr 14 '14 at 0:02
  • $\begingroup$ @userunknown This solution only works specifically for X=4 because a new song must be played EACH time. finding a solution for X=5 is much different $\endgroup$ – Sidd Singal Apr 14 '14 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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