Finding the common difference and forming the sequence