login
A140757
Cumulative sums of A140756.
2
1, 0, 2, 3, 1, 4, 3, 5, 2, 6, 7, 5, 8, 4, 9, 8, 10, 7, 11, 6, 12, 13, 11, 14, 10, 15, 9, 16, 15, 17, 14, 18, 13, 19, 12, 20, 21, 19, 22, 18, 23, 17, 24, 16, 25, 24, 26, 23, 27, 22, 28, 21, 29, 20, 30, 31, 29, 32, 28, 33, 27, 34, 26, 35, 25, 36, 35, 37, 34, 38, 33, 39, 32, 40, 31, 41
OFFSET
1,3
COMMENTS
Each positive integer occurs exactly twice in this sequence, with 0 occurring only once. In particular, if A002620(n) < m < A002620(n+1), then m occurs in rows n-1 and n; and A002620(n) occurs in rows in rows n-1 (as T(n-1,n-1)) and n+1 (as T(n+1,n)).
LINKS
FORMULA
T(n,k) = floor((n+(-1)^{n-k})^2/4) - (-1)^{n-k}*floor((n-k)/2), as a triangle, with n >= 1, 1 <= k <= n.
EXAMPLE
As a triangle:
1;
0, 2;
3, 1, 4;
3, 5, 2, 6;
7, 5, 8, 4, 9;
8, 10, 7, 11, 6, 12;
...
MATHEMATICA
A140756[n_]:= With[{t=Floor[(-1+Sqrt[8*n-7])/2]}, (-1)^(Binomial[t+2, 2] -n)*(n -Binomial[t+1, 2])];
A140757[n_]:= Sum[A140756[j], {j, n}];
Table[A140757[n], {n, 100}] (* G. C. Greubel, Oct 21 2023 *)
PROG
(PARI) T(n, k)=if((n-k)%2==0, ((n+1)^2\4)-((n-k)\2), ((n-1)^2\4)+((n-k)\2) ) - Paul D. Hanna
(Magma)
A140756:=[(-1)^(n+k)*k: k in [1..n], n in [1..40]];
A140757:= func< n | (&+[A140756[j]: j in [1..n]]) >;
[A140757(n): n in [1..100]]; // G. C. Greubel, Oct 21 2023
(SageMath)
A140756=flatten([[(-1)^(n+k)*k for k in range(1, n+1)] for n in range(1, 41)])
def A140757(n): return sum(A140756[j] for j in range(n))
[A140757(n) for n in range(1, 101)] # G. C. Greubel, Oct 21 2023
CROSSREFS
Sequence in context: A067992 A317024 A354803 * A258254 A100035 A201927
KEYWORD
easy,nonn,tabl
AUTHOR
STATUS
approved