%I #33 Jan 01 2024 11:53:38
%S 1,4,4,4,5,8,8,8,9,12,12,12,13,16,16,16,17,20,20,20,21,24,24,24,25,28,
%T 28,28,29,32,32,32,33,36,36,36,37,40,40,40,41,44,44,44,45,48,48,48,49,
%U 52,52,52,53,56,56,56,57,60,60,60,61,64,64,64,65,68,68,68,69,72,72,72
%N a(4*n) = 4*n+1, a(4*n+1) = a(4*n+2) = a(4*n+3) = 4*n+4.
%H Colin Barker, <a href="/A127932/b127932.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 G.f.: (1 + 3*x) / (1 - x - x^4 + x^5).
%F From _Luce ETIENNE_, Jan 28 2017: (Start)
%F a(n) = a(n-1)+ a(n-4)- a(n-5).
%F a(n) = (4*n+7-(-1)^n+(-1)^((2*n-1+(-1)^n)/4)-3*(-1)^((2*n+1-(-1)^n)/4))/4.
%F a(n) = (4*n+7-cos(n*Pi)-2*(cos(n*Pi/2)-2*sin(n*Pi/2)))/4.
%F (End)
%e G.f. = 1 + 4*x + 4*x^2 + 4*x^3 + 5*x^4 + 8*x^5 + 8*x^6 + 8*x^7 + 9*x^8 + ...
%t Table[{n,Table[n+3,3]},{n,1,69,4}]//Flatten (* _Harvey P. Dale_, Nov 08 2016 *)
%t LinearRecurrence[{1, 0, 0, 1, -1}, {1, 4, 4, 4, 5}, 75] (* _Vincenzo Librandi_, May 01 2018 *)
%o (PARI) {a(n) = if( n%4==0, n+1, n+4 - (n%4))}; /* _Michael Somos_, Jan 28 2017 */
%o (PARI) Vec((1 + 3*x) / ((1 - x)^2*(1 + x)*(1 + x^2)) + O(x^100)) \\ _Colin Barker_, Jan 28 2017
%o (Magma) [Round((4*n+7-(-1)^n+(-1)^((2*n-1+(-1)^n)/4)-3*(-1)^((2*n+1- (-1)^n )/4))/4): n in [0..50]]; // _G. C. Greubel_, Apr 30 2018
%o (Magma) I:=[1,4,4,4,5]; [n le 5 select I[n] else Self(n-1)+Self(n-4)- Self(n-5): n in [1..80]]; // _Vincenzo Librandi_, May 01 2018 *)
%K nonn,easy
%O 0,2
%A _Philippe Deléham_, Apr 06 2007
|