Problem

Source: Moldova TST 2018

Tags: algorithm, arithmetic sequence, combinatorics



A pupil is writing on a board positive integers $x_0,x_1,x_2,x_3...$ after the following algorithm which implies arithmetic progression $3,5,7,9...$.Each term of rank $k\ge2$ is a difference between the product of the last number on the board and the term of arithmetic progression of rank $k$ and the last but one term on the bord with the sum of the terms of the arithemtic progression with ranks less than $k$.If $x_0=0 $ and $x_1=1$ find $x_n$ according to n.