nth term of a number pattern