This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A319674 #28 Dec 20 2024 12:34:31 %S A319674 1,3,6,2,-3,-9,-2,6,15,5,-6,-18,-5,9,24,8,-9,-27,-8,12,33,11,-12,-36, %T A319674 -11,15,42,14,-15,-45,-14,18,51,17,-18,-54,-17,21,60,20,-21,-63,-20, %U A319674 24,69,23,-24,-72,-23,27,78,26,-27,-81,-26,30,87,29,-30,-90,-29 %N A319674 a(n) = 1 + 2 + 3 - 4 - 5 - 6 + 7 + 8 + 9 - 10 - 11 - 12 + ... - (up to n). %C A319674 In general, for sequences that add the first k natural numbers and then subtract the next k natural numbers, and continue to alternate in this way up to n, we have a(n) = Sum_{i=1..n} i*(-1)^floor((i-1)/k). Here, k=3. %H A319674 Colin Barker, <a href="/A319674/b319674.txt">Table of n, a(n) for n = 1..1000</a> %H A319674 <a href="/index/Rec#order_07">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,-2,2,0,-1,1). %F A319674 a(n) = Sum_{i=1..n} i*(-1)^floor((i-1)/3). %F A319674 From _Colin Barker_, Sep 26 2018: (Start) %F A319674 G.f.: x*(1 + 2*x + 3*x^2 - 2*x^3 - x^4) / ((1 - x)*(1 + x)^2*(1 - x + x^2)^2). %F A319674 a(n) = a(n-1) - 2*a(n-3) + 2*a(n-4) - a(n-6) + a(n-7) for n>7. %F A319674 (End) %F A319674 Conjectures from _Bill McEachen_, Dec 19 2024: (Start) %F A319674 For a(n)>0 and n=A047235(m), a(n) = n/2 + 2*Mod(m,2), otherwise a(n) = 3*(n+1)/2. %F A319674 For a(n)<0 and n=A007310(m), a(n)= 1 + (1-n)/2 + 2*(Mod(m,2)-1), otherwise a(n) = -3*n/2. (End) %e A319674 a(1) = 1; %e A319674 a(2) = 1 + 2 = 3; %e A319674 a(3) = 1 + 2 + 3 = 6; %e A319674 a(4) = 1 + 2 + 3 - 4 = 2; %e A319674 a(5) = 1 + 2 + 3 - 4 - 5 = -3; %e A319674 a(6) = 1 + 2 + 3 - 4 - 5 - 6 = -9; %e A319674 a(7) = 1 + 2 + 3 - 4 - 5 - 6 + 7 = -2; %e A319674 a(8) = 1 + 2 + 3 - 4 - 5 - 6 + 7 + 8 = 6; %e A319674 a(9) = 1 + 2 + 3 - 4 - 5 - 6 + 7 + 8 + 9 = 15; %e A319674 a(10) = 1 + 2 + 3 - 4 - 5 - 6 + 7 + 8 + 9 - 10 = 5; etc. %t A319674 Table[Sum[i (-1)^Floor[(i - 1)/3], {i, n}], {n, 60}] %t A319674 Accumulate[Flatten[If[EvenQ[#[[1]]],-#,#]&/@Partition[Range[70],3]]] (* or *) LinearRecurrence[{1,0,-2,2,0,-1,1},{1,3,6,2,-3,-9,-2},70] (* _Harvey P. Dale_, Sep 15 2021 *) %o A319674 (PARI) Vec(x*(1 + 2*x + 3*x^2 - 2*x^3 - x^4) / ((1 - x)*(1 + x)^2*(1 - x + x^2)^2) + O(x^60)) \\ _Colin Barker_, Sep 26 2018 %Y A319674 Cf. A001057 (k=1), A077140 (k=2), this sequence (k=3). %K A319674 sign,look,easy %O A319674 1,2 %A A319674 _Wesley Ivan Hurt_, Sep 25 2018