A380231 Alternating row sums of triangle A237591.
1, 2, 1, 2, 1, 4, 3, 4, 5, 4, 3, 6, 5, 4, 7, 8, 7, 8, 7, 10, 9, 8, 7, 10, 11, 10, 9, 12, 11, 14, 13, 14, 13, 12, 15, 16, 15, 14, 13, 16, 15, 18, 17, 16, 19, 18, 17, 20, 21, 22, 21, 20, 19, 22, 21, 24, 23, 22, 21, 24, 23, 22, 25, 26, 25, 28, 27, 26, 25, 28, 27, 32, 31, 30, 29, 28, 31, 30, 29
Offset: 1
Examples
For n = 14 the 14th row of A237591 is [8, 3, 1, 2] hence the alternating row sum is 8 - 3 + 1 - 2 = 4, so a(14) = 4. On the other hand the 14th row of A237593 is the 14th row of A237591 together with the 14 th row of A237591 in reverse order as follows: [8, 3, 1, 2, 2, 1, 3, 8]. Then with the terms of the 14th row of A237593 we can draw a Dyck path in the first quadrant of the square grid as shown below: . (y axis) . . . (4,14) (14,14) ._ _ _ . _ _ _ _ . . | . | . |_ . | . |_ _ . C |_ _ _ . | . | . | . | . . (14,4) . | . | . . . . . . . . . . . . . . | . . . (x axis) (0,0) . In the example the point C is the point (9,9). The three line segments [(4,14),(9,9)], [(14,4),(9,9)] and [(14,14),(9,9)] have the same length. The points (14,14), (9,9) and (4,14) are the vertices of a virtual isosceles right triangle. The points (14,14), (9,9) and (14,4) are the vertices of a virtual isosceles right triangle. The points (4,14), (14,14) and (14,4) are the vertices of a virtual isosceles right triangle.
Links
- Paolo Xausa, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Mathematica
A380231[n_] := 2*Sum[(-1)^(k + 1)*Ceiling[(n + 1)/k - (k + 1)/2], {k, Quotient[Sqrt[8*n + 1] - 1, 2]}] - n; Array[A380231 , 100] (* Paolo Xausa, Sep 06 2025 *)
-
PARI
row235791(n) = vector((sqrtint(8*n+1)-1)\2, i, 1+(n-(i*(i+1)/2))\i); a(n) = my(orow = concat(row235791(n), 0)); vecsum(vector(#orow-1, i, (-1)^(i+1)*(orow[i] - orow[i+1]))); \\ Michel Marcus, Apr 13 2025
Comments