nth term of a sequence from a table