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 A306562 #38 Jun 08 2025 13:40:34 %S A306562 1,3,0,-4,1,7,14,6,-3,-13,-24,-12,1,15,30,46,29,11,-8,-28,-49,-71,-48, %T A306562 -24,1,27,54,82,111,81,50,18,-15,-49,-84,-120,-157,-119,-80,-40,1,43, %U A306562 86,130,175,221,174,126,77,27,-24,-76,-129,-183,-238,-294,-237,-179 %N A306562 a(n) = 1 + 2 - 3 - 4 + 5 + 6 + 7 - 8 - 9 - 10 - 11 + 12 + 13 + 14 + 15 + ... + (+-1)*n, where, after the 1st summand there is one plus, two minuses, three plusses, etc. %H A306562 Alois P. Heinz, <a href="/A306562/b306562.txt">Table of n, a(n) for n = 0..10011</a> (first 1001 terms from Harvey P. Dale) %F A306562 F(n) = ((-1)^(n+1)(2n+1)(2n^2+2n+5)+21)/16 gives local extrema 3, -4, 14, -24, 46, -71, 111, -157, ... (conjectured). - _Jean-François Alcover_, Jun 01 2019 %F A306562 For n > 0, a(n) = 1 + Sum_{k=1..n} (-1)^(A002024(k)+1)*(k+1). - _Jinyuan Wang_, Aug 06 2019 %F A306562 a(n) = 1 <=> n in { A046092 }. - _Alois P. Heinz_, Jun 08 2025 %e A306562 a(0) = 1 = 1 %e A306562 a(1) = 1 + 2 = 3 %e A306562 a(2) = 1 + 2 - 3 = 0 %e A306562 a(3) = 1 + 2 - 3 - 4 = -4 %e A306562 a(4) = 1 + 2 - 3 - 4 + 5 = 1 %e A306562 a(5) = 1 + 2 - 3 - 4 + 5 + 6 = 7 %e A306562 a(6) = 1 + 2 - 3 - 4 + 5 + 6 + 7 = 14 %p A306562 a:= proc(n) option remember: `if`(n=0, 1, %p A306562 a(n-1)+(n+1)*(-1)^floor(sqrt(2*n)-1/2)) %p A306562 end: %p A306562 seq(a(n), n=0..60); # _Alois P. Heinz_, Feb 26 2019 %t A306562 With[{nn=20},Accumulate[Flatten[Join[{1,2},Times@@@Partition[Riffle[TakeList[Range[3,3+(nn(nn+1))/2],Range[2,nn]],{-1,1}],2]]]]] (* _Harvey P. Dale_, Mar 24 2024 *) %o A306562 (Python) %o A306562 from math import isqrt %o A306562 def A306562(n): return 1+sum((k if isqrt(k-1<<3)+1&2 else -k) for k in range(2,n+2)) # _Chai Wah Wu_, Jun 07 2025 %Y A306562 Cf. A000217, A002024, A046092, A064520. %K A306562 sign,look %O A306562 0,2 %A A306562 _Brandon J. Butierres_, Feb 23 2019 %E A306562 New name from _Michel Marcus_, Apr 11 2019