Scala based solution to Josephus Problem