Nth term of a sequence