Implements Recycled Numbers with Scala in a Functional style