Finding the missing terms in a sequence