PlayLists

I have 10 songs with me. On my way home, I want to listen to 30 songs (some songs will be repeated). However, I don't want to listen the same song again too soon. Precisely, there should be at-least an interval of 5 songs before I hear the same song again.

Example: Say, I have songs A, B, C, D, E,..
Then, the playlist A,B,C,D,E,F,A,B,C,D,E,F...is valid but the playlist A,B,C,A,... is not valid because there are only 2 songs between 2 occurrences of song A.

How many playlists can I have?

14 comments:

  1. bahiya,how many songs we can have before repeating same song.

    ReplyDelete
    Replies
    1. Its specified in the problem statement:
      "Precisely, there should be at-least an interval of 5 songs before I hear the same song again."

      Delete
  2. if there is a difference of atleast 2 songs then no of playlists=10x9x8^28
    if atleast 3 songs playlists=10x9x8x7^27
    if atleast 4 songs play lists=10x9x8x7x6^26
    if atleast 5 songs playlists=10x9x8x7x6x5^25
    so on and so forth
    if atleast 9 songs plaaylist=10x9x8x7x6x5x4x3x2x1^21

    ReplyDelete
  3. i m sorry did'nt read the question full
    no of ways=10x9x8x7x6x5^25

    ReplyDelete
  4. Shivam is right..

    now try the problem with the condition that EACH song must be played "at least" once..

    ReplyDelete
    Replies
    1. nah..please don't try it (at home, or at school).

      Delete
  5. no of ways=10x9x8x7x6x5^25 - (10C9)x9x8x7x6x5x4^25
    --------------- --------------------
    total no of ways no of ways in which
    9 songs are played.
    leaving one song.

    ReplyDelete
  6. no of ways=10x9x8x7x6x5^25-(10C9)9x8x7x6x5x4^25

    req no of ways=(total no of ways to play 10 songs with orignal condition)-(no of ways to play 9 songs leaving one song(again with orignal condition)).
    orignal condition=(song is repeated atleast after 5 songs)

    ReplyDelete
    Replies
    1. You're on the right track but its not complete.

      Req. no of ways=
      (total no of ways to play 10 songs)-(no of ways to play 9 songs leaving 1 song)+(no of ways to play 8 songs leaving 2 songs)-(no of ways to play 7 songs leaving 3 songs)+....

      This will remind you of |A U B U C U D|=(|A|+|B|+|C|+|D|)-(|A^B|+|A^C|+...)+(|A^B^C|+|A^C^D|...)-(|A^B^C^D|)

      A U B is the union of 2 sets, A^B is intersection and |A| is the number of elements in set A.

      Delete
  7. bahiya when we calculated the no of ways to palay 10 songs in it we also counted the number of ways of playing only 9 songs and other cases as well ( thats why we are subtracting those cases from it), same is in this case when we count no of ways to play 9 songs, in it those cases are already counted in which only 8 songs or less than 8 songs are played ,so we dont need to subtract other cases.and sorry for late reply.

    ReplyDelete
    Replies
    1. The correct answer is definitely: (total no of ways to play at least 10 songs)-(no of ways to play atleast 9 songs). I was wrong here.

      But how do you calculate: no of ways to play atleast 9 songs? You calculated the number of ways in which song 1 was removed, ways in which song 2 was removed....and added them all up.

      There are a lot of overlapping 'ways' that must be removed. For example: 'ways in which atleast 9 songs are played and song 1 is removed' contains the playlist "3,4,5,6,7,8,9,10". This playlist is also contained in 'ways in which atleast 9 songs are played and song 2 is removed'.

      Basically, they're not disjoint.

      Delete