Problem

Source: Iranian National Olympiad (3rd Round) 2003

Tags: induction, number theory proposed, number theory



Let $ a_1=a_2=1$ and \[ a_{n+2}=\frac{n(n+1)a_{n+1}+n^2a_n+5}{n+2}-2\]for each $ n\in\mathbb N$. Find all $ n$ such that $ a_n\in\mathbb N$.