OFFSET
1,3
COMMENTS
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..5000
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])];
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(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)])
[A140757(n) for n in range(1, 101)] # G. C. Greubel, Oct 21 2023
CROSSREFS
KEYWORD
AUTHOR
Franklin T. Adams-Watters, May 27 2008
STATUS
approved