%I #20 Jun 30 2022 01:50:00
%S 1,3,7,13,21,23,27,33,41,43,47,53,61,63,67,73,81,83,87,93,101,103,107,
%T 113,121,123,127,133,141,143,147,153,161,163,167,173,181,183,187,193,
%U 201,203,207,213,221,223,227,233,241,243,247,253,261,263,267,273,281,283
%N a(n) = a(n-1) + (2*n - 1) mod 8 + 1 with a(0)=1.
%C Numbers == 1, 3, 7, 13 modulo 20. - _Ralf Stephan_, May 15 2007
%H Colin Barker, <a href="/A100531/b100531.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,1,-1).
%F a(n) = a(n-1) + a(n-4) - a(n-5), with a(0)=1, a(1)=3, a(2)=7, a(3)=13, a(4)=21. - _Harvey P. Dale_, Apr 09 2012
%F G.f.: (1+2*x+4*x^2+6*x^3+7*x^4)/((1-x)^2*(1+x+x^2+x^3)). - _Harvey P. Dale_, Apr 09 2012
%F a(n) = 5*n - (3-(-1)^n)/2 + i^n + (-i)^n, where i=sqrt(-1). - _Colin Barker_, Oct 16 2015
%F E.g.f.: (5*x-1)*cosh(x) + (5*x-2)*sinh(x) + 2*cos(x). - _G. C. Greubel_, Jun 30 2022
%t f[n_]:= f[n]= If[n==0,1,f[n-1]+Mod[2*n-1, 8]+1]; Table[f[n], {n,0,100}]
%t RecurrenceTable[{a[0]==1,a[n]==a[n-1]+Mod[2n-1,8]+1},a,{n,60}] (* or *) LinearRecurrence[{1,0,0,1,-1},{1,3,7,13,21},60] (* _Harvey P. Dale_, Apr 09 2012 *)
%o (PARI) a(n) = (5*n-3/2+(-1)^n/2+(-I)^n+I^n) \\ _Colin Barker_, Oct 16 2015
%o (PARI) Vec((7*x^4+6*x^3+4*x^2+2*x+1)/((x-1)^2*(x^3+x^2+x+1)) + O(x^100)) \\ _Colin Barker_, Oct 16 2015
%o (Magma) [n mod 2 eq 0 select Round(5*n-1+2*(-1)^(n/2)) else Round(5*n-2): n in [0..100]]; // _G. C. Greubel_, Jun 30 2022
%o (SageMath) [5*n-1 -(n%2) +2*i^n*((n+1)%2) for n in (0..60)] # _G. C. Greubel_, Jun 30 2022
%K nonn,easy
%O 0,2
%A _Roger L. Bagula_, Nov 24 2004