Problem

Source: Mathematics and Youth Magazine (vietnam)

Tags: number theory, arithmetic sequence



The sequence $\left(a_n \right)$ is defined by $a_1=1, \ a_2=2$ and $$a_{n+2} = 2a_{n+1}-pa_n, \ \forall n \ge 1,$$for some prime $p.$ Find all $p$ for which there exists $m$ such that $a_m=-3.$