"...By Zipf’s Law, you expect that the first song is listened to twice as often as the second song, and more generally that the first song is listened to i times as often as the i’th song.
When some songs are better than others, those will be listened to more often than predicted by Zipf’s Law, and those are the songs your program should select as the good songs.
Specifically, suppose that song i has been played fi times but that Zipf’s Law predicts that it would have been played zi times.
Then you define the quality of song i to be qi = fi / zi. Your software should select the songs with the highest values of qi."
** All problems solved in both Ruby and Python