Finding the common difference and nth term in an AP