%I #24 Oct 07 2017 22:11:05
%S 0,1,1,1,0,-1,0,1,1,1,0,-1,0,1,1,1,0,-1,0,1,1,1,0,-1,0,1,1,1,0,-1,0,1,
%T 1,1,0,-1,0,1,1,1,0,-1,0,1,1,1,0,-1,0,1,1,1,0,-1,0,1,1,1,0,-1,0,1,1,1,
%U 0,-1,0,1,1,1,0,-1,0,1,1,1,0,-1,0,1,1,1,0,-1,0,1,1,1,0,-1,0,1,1,1,0,-1,0,1,1,1,0
%N Numerators of A189733: periodic sequence repeating [0, 1, 1, 1, 0, -1].
%C See A189733.
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,-1,1,-1,1).
%F G.f.: x*(1+x^2-x^3)/((1-x)*(1-x+x^2)*(1+x+x^2)).
%F From _Wesley Ivan Hurt_, Oct 03 2017: (Start)
%F a(n) = a(n-1) - a(n-2) + a(n-3) - a(n-4) + a(n-5) for n > 4.
%F a(n) = (1+(-1)^floor((n-1)/3))/2-floor((n+1)/6)+floor(n/6). (End)
%t b[m_, n_] := b[m, n] = Which[m == n, 0, n == m + 1, (-1)^(n + 1)/n, n > m, b[m, n - 1] + b[m + 1, n - 1], n < m, b[m - 1, n + 1] - b[m - 1, n]]; a[n_] := b[0, n] // Numerator; Table[a[n], {n, 0, 100}]
%t (* or, simply: *)
%t a[n_] := {0, 1, 1, 1, 0, -1}[[Mod[n, 6]+1]]; Table[a[n], {n, 0, 100}]
%o (PARI) Vec(x*(1+x^2-x^3)/((1-x)*(1-x+x^2)*(1+x+x^2))+O(x^99)) \\ _Charles R Greathouse IV_, Dec 02 2016
%Y Cf. A189733, A194767, A267068.
%K frac,sign,easy
%O 0
%A _Jean-François Alcover_ and _Paul Curtz_, Nov 30 2016
|