Finding the next terms or determining arithmetic sequence