# $2021^{\text{st}}$ term of a Sequence

Q. Let sequence ${a_{n}}$ satisfy $$a_{1} = 1, a_{2}=4, a_{3}=5$$ and $$a_{n}+a_{n-1}+a_{n-2}+a_{n-3}=n^2$$ $$\forall n \geq 4$$ Then find the sum of the digits of $a_{2021}$ .

My attempt: The given sequence isn't making any progression . So I tried to calculate the furthur terms of the series and tried to get a possible sequence for the terms. However I was unsuccessful in that! Then I attempt to make a possible sequence for the sum of the digits of the further terms in the series, which got ruined too! Now I have no clue how to get on with that problem! I think forming a function of n as a difference of two terms would help but please could you suggest how to make it? Please help.

For $n\geq 4$ we have: $$a_{n+1}-a_{n-3}=(a_{n+1}+a_n+a_{n-1}+a_{n-2})-(a_n+a_{n-1}+a_{n-2}+a_{n-3})$$ $$=(n+1)^2-n^2=2n+1$$ So that $$a_{2021}=(2\cdot 2021 -1)+(2\cdot 2017-1)+\dots+(2\cdot5-1)+a_1$$

I think you can take it from here?

• Done! Sorry for the late reply! Thanks Jul 8, 2018 at 14:49

For $n\geq 5$

$a_n+(n-1)^2 =a_n+a_{n-1}+a_{n-2}+a_{n-3}+a_{n-4}=$

$=n^2+a_{n-4}$

so

$a_n=a_{n-4}+2n-1$

and in the case $n=2021$ you have that

$a_{2021}=2n-1+\sum_{k=1}^{504} (2(n-4k)-1)+a_5=$

$505(2n-1)-8\sum_{k=1}^{504}k+a_5=$

$=505(2n-1)-8\frac{504\cdot 505}{2}+a_5=$

$=505(2n-1-4\cdot 504)+a_5$

• n=2021, (n-5):4=504 Jul 7, 2018 at 22:46

The homogeneous linear recurrence $$x_n = -x_{n-1} - x_{n-2} - x_{n-3}$$ with $x_0=1, x_{<0}=0$ is easily solved by direct calculation and gives the nice result $$(h_n)_n = (1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, \ldots)$$

You want to solve an inhomogeneous recurrence $$a_n = -a_{n-1} - a_{n-2} - a_{n-3} + c_n$$ The solution of that is the sum of shifted versions of the homogeneous solution, scaled by the $c_n$s: $$a_n = \sum_{k\le n} c_k h_{n-k}$$

We already know the $c_n$s for $n\ge 4$, namely $c_n=n^2$, and we can find the first $c_n$s such that the known initial values of $a_n$ come out right: $$c_1 = 1 \qquad c_2 = 5 \qquad c_3 = 10$$ (though $c_2$ and $c_3$ end up not mattering). Putting this together we have \begin{align} a_{2021} &= c_{2021}-c_{2020} + c_{2017}-c_{2016} + \cdots + c_5 - c_4 + c_1 \\&= 2021^2-2020^2 + 2017^2-2016^2 + \cdots + 5^2 - 4^2 + 1 \\&= (2\cdot 2020+1) + (2\cdot 2016+1) + \cdots + (2\cdot 4+1) + 1 \end{align} and this finite arithmetic series is easy to sum.

• Good to have this explained even though the easy summability of the "convolution" depends on the special form of the homogeneous solution (leading to Adam's +1 solution). Jul 8, 2018 at 4:01
• What is amazing to show is $a_n=\frac{1}{4} \left(1+n (n+3)-\sin \left(\frac{\pi n}{2}\right)-5 \cos \left(\frac{\pi n}{2}\right)\right)$ Jul 8, 2018 at 5:52
• Nice approach! Thanks Jul 8, 2018 at 14:51
• @ClaudeLeibovici .Wow! That's interesting! I never thought $a_{n}$ would come out a function of n . Jul 8, 2018 at 14:59
• @CreepAnonymous. I was almost sure that it could even be simple. I started writing $a_n=b_n+\alpha+\beta n+\gamma n^2$; then compute what is required to make a simple linear recurrence relation and so on. I had fun and I thank you for that ! Jul 8, 2018 at 16:26