login
Four steps forward, three steps back.
7

%I #31 Dec 27 2023 12:13:57

%S 0,1,2,3,4,3,2,1,2,3,4,5,4,3,2,3,4,5,6,5,4,3,4,5,6,7,6,5,4,5,6,7,8,7,

%T 6,5,6,7,8,9,8,7,6,7,8,9,10,9,8,7,8,9,10,11,10,9,8,9,10,11,12,11,10,9,

%U 10,11,12,13,12,11,10,11,12,13,14,13,12,11

%N Four steps forward, three steps back.

%H G. C. Greubel, <a href="/A260644/b260644.txt">Table of n, a(n) for n = 0..1000</a> (a(301) = 43 corrected by Georg Fischer, Apr 10 2019 *)

%H <a href="/index/Rec#order_08">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,0,0,0,1,-1).

%F G.f.: x*(1+x+x^2+x^3-x^4-x^5-x^6) / ((1-x)^2*(1+x+x^2+x^3+x^4+x^5+x^6)).

%F a(n) = a(n-1) + a(n-7) - a(n-8) for n>7.

%F a(n) = Sum_{i=1..n} (-1)^floor((2i - 2)/7).

%e a(6k): 0, 2, 4, 6, 6, 6, 6, 6, 8, 10, 12, 12, 12, 12, 12, 14, ...

%e a(6k+1): 1, 1, 3, 5, 7, 7, 7, 7, 7, 9, 11, 13, 13, 13, 13, 13, ...

%e a(6k+2): 2, 2, 2, 4, 6, 8, 8, 8, 8, 8, 10, 12, 14, 14, 14, 14, ...

%e a(6k+3): 3, 3, 3, 3, 5, 7, 9, 9, 9, 9, 9, 11, 13, 15, 15, 15, ...

%e a(6k+4): 4, 4, 4, 4, 4, 6, 8, 10, 10, 10, 10, 10, 12, 14, 16, 16, ...

%e a(6k+5): 3, 5, 5, 5, 5, 5, 7, 9, 11, 11, 11, 11, 11, 13, 15, 17, ...

%p A260644:=n->add((-1)^floor((2*i-2)/7), i=1..n): seq(A260644(n), n=0..100);

%t Table[Sum[(-1)^Floor[(2 i - 2)/7], {i, n}], {n, 0, 100}]

%t LinearRecurrence[{1,0,0,0,0,0,1,-1},{0,1,2,3,4,3,2,1},90] (* _Harvey P. Dale_, Dec 27 2023 *)

%o (PARI) concat(0, Vec((x+x^2+x^3+x^4-x^5-x^6-x^7)/((x-1)^2*(1+x+x^2+x^3+x^4+x^5+x^6)) + O(x^100))) \\ _Altug Alkan_, Nov 12 2015

%Y Cf. A008611 (one step back, two steps forward).

%Y Cf. A058207 (three steps forward, two steps back).

%K nonn,easy

%O 0,3

%A _Wesley Ivan Hurt_, Nov 11 2015