Finding the first term in a sequence