I want to know the formula for the general term of the following recurrence system. I guess it can be written with Floor
or Mod
. How can I find it?
RSolve[{a[n + 5] == a[n] + 6, a[1] == 1, a[2] == 3, a[3] == 2, a[4] == 1, a[5] == 1}, a[n], n]
DiscretePlot[-2 + (6 n)/5 +
2/5 Sqrt[28 + 53/Sqrt[5]] Sin[(2 n π)/5 - ArcTan[15/Sqrt[85 + 38 Sqrt[5]]]] +
2/5 Sqrt[28 - 53/Sqrt[5]] Sin[(4 n π)/5 - ArcTan[3 Sqrt[5 (85 + 38 Sqrt[5])]]],
{n, 1, 20}]
Updated
I would like to have the formula for the general term without using recursion just as
RecurrenceTable[{y[n + 5] == y[n] + 1,
Sequence @@ Table[y[i] == i, {i, 5}]}, y, {n, 1, 30}]
can be written
n - 4 Floor[(n - 1)/5] /. n -> Range@30
b[n_] := 6*(n - Mod[n, 5, 1])/5 + {1, 3, 2, 1, 1}.Map[DiscreteDelta, Mod[n, 5, 1] - Range[5]]
$\endgroup$