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 A140756 #21 Jun 10 2025 01:15:34 %S A140756 1,-1,2,1,-2,3,-1,2,-3,4,1,-2,3,-4,5,-1,2,-3,4,-5,6,1,-2,3,-4,5,-6,7, %T A140756 -1,2,-3,4,-5,6,-7,8,1,-2,3,-4,5,-6,7,-8,9,-1,2,-3,4,-5,6,-7,8,-9,10, %U A140756 1,-2,3,-4,5,-6,7,-8,9,-10,11,-1,2,-3,4,-5,6,-7,8,-9,10,-11,12,1,-2,3,-4,5,-6,7,-8,9,-10,11,-12,13 %N A140756 Count up to k sequence with alternating signs (k always positive). %C A140756 Row sums are A004526(n+1). %H A140756 G. C. Greubel, <a href="/A140756/b140756.txt">Table of n, a(n) for n = 1..5000</a> %F A140756 Regarded as a triangle, T(n,k) = (-1)^{n-k} * k. %F A140756 From _Boris Putievskiy_, Mar 14 2013: (Start) %F A140756 a(n) = (-1)^(A004736(n) + 1) * A002260(n). %F A140756 a(n) = (-1)^(j+1) * i, where i = n - t*(t+1)/2, j = (t^2 + 3*t + 4)/2 -n, and t = floor((-1 + sqrt(8*n-7))/2). (End) %e A140756 Triangle begins: %e A140756 1; %e A140756 -1, 2; %e A140756 1, -2, 3; %e A140756 -1, 2, -3, 4; %e A140756 1, -2, 3, -4, 5; %e A140756 -1, 2, -3, 4, -5, 6; %t A140756 a[n_]:= With[{t=Floor[(-1+Sqrt[8*n-7])/2]}, (-1)^(Binomial[t+2,2] -n)*(n-Binomial[t+1,2])]; %t A140756 Table[a[n], {n,100}] (* _G. C. Greubel_, Oct 21 2023 *) %o A140756 (Magma) [(-1)^(n+k)*k: k in [1..n], n in [1..12]]; // _G. C. Greubel_, Oct 21 2023 %o A140756 (SageMath) flatten([[(-1)^(n+k)*k for k in range(1,n+1)] for n in range(1,13)]) # _G. C. Greubel_, Oct 21 2023 %o A140756 (Python) %o A140756 from math import comb, isqrt %o A140756 def A140756(n): return comb(r,2)-n if comb((r:=(m:=isqrt(k:=n<<1))+(k>m*(m+1)))+1,2)-n&1 else n-comb(r,2) # _Chai Wah Wu_, Jun 09 2025 %Y A140756 Cf. A002260, A004736, A140757. %K A140756 easy,sign,tabl %O A140756 1,3 %A A140756 _Franklin T. Adams-Watters_, May 27 2008