Topcoder IncrementingSequence problem - beautiful solution