Pregunta de entrevista de Norfolk Southern

Write a code to find the nth term in a sequence