Finding the first terms of a sequence