# I want to solve this difference equation: $H_{n+1}-(1+r^{2n+1})H_{n}=2-r^{2n+1}p_{n}$

Let $r>4$ be a positive integer. Let $p_{n}$ be the sequence of prime numbers with $n≥3$. I wante to solve this difference equation:

$$H_{n+1}-(r^{2n+1}+1)H_{n}=2-r^{2n+1}p_{n}$$ where $H_{n}$ is the unknown and $H_{3}=5$. I have no idea to start.

• Do you mean $p_3 =2,p_4=3,p_5=5$ etc. ? – Jeb Sep 29 '15 at 18:54
• @Jeb: Yes, this is the case. – DER Sep 29 '15 at 18:55
• What are you assuming for $H_3$ ?, i.e.the initial data – Jeb Sep 29 '15 at 18:56
• @Jeb: We can take it 5. – DER Sep 29 '15 at 18:57

Notice you have $$H_{n+1} = (r^{2n+1}+1) H_n + (2 - r^{2n+1 } p_n)$$ The first few terms are $$H_4 = ( r^7 +1) H_3 + (2 - p_3r^{7} )$$ $$H_5 = ( r^9 +1) H_4 + (2 - p_4 r^9 ) = ( r^9 +1) ( r^7 +1)H_3 + ( r^9 +1)(2 - p_3r^{7} ) + (2 - p_4 r^9)$$ Thus if you iterate this you'll find $$H_n = H_3\prod_{k=3}^{n-1} ( r^{2k+1} +1) + \sum_{k=3}^{n-1}(2-r^{2k+1}p_k) \prod_{l=k}^{n-2} ( r^{2l+3} +1)$$
I have changed $n$ by $k$ in the indice of the prime number $p_n$ in the last equation.
• @ jeb: It seems also the expression is wrong even for $n=5$.. – DER Sep 30 '15 at 9:09