%I #274 Jan 02 2023 12:30:48
%S 1,3,5,1,7,0,9,3,11,0,1,13,5,0,15,0,0,17,7,3,19,0,0,1,21,9,0,0,23,0,5,
%T 0,25,11,0,0,27,0,0,3,29,13,7,0,1,31,0,0,0,0,33,15,0,0,0,35,0,9,5,0,
%U 37,17,0,0,0,39,0,0,0,3,41,19,11,0,0,1,43,0,0,7,0,0,45,21,0,0,0,0,47,0,13,0,0,0
%N Irregular triangle read by rows: T(n,k), n >= 1, k >= 1, in which column k lists the odd numbers interleaved with k-1 zeros, and the first element of column k is in row k(k+1)/2.
%C Gives an identity for sigma(n): alternating sum of row n equals the sum of divisors of n. For proof see _Max Alekseyev_ link.
%C Row n has length A003056(n) hence column k starts in row A000217(k).
%C The number of positive terms in row n is A001227(n), the number of odd divisors of n.
%C If n = 2^j then the only positive integer in row n is T(n,1) = 2^(j+1) - 1.
%C If n is an odd prime then the only two positive integers in row n are T(n,1) = 2n - 1 and T(n,2) = n - 2.
%C If T(n,k) = 3 then T(n+1,k+1) = 1, the first element of the column k+1.
%C The partial sums of column k give the column k of A236104.
%C The connection with the symmetric representation of sigma is as follows: A236104 --> A235791 --> A237591 --> A237593 --> A239660 --> A237270.
%C Alternating sum of row n equals the number of units cubes that protrude from the n-th level of the stepped pyramid described in A245092. - _Omar E. Pol_, Oct 28 2015
%C Conjecture: T(n,k) is the difference between the square of the total number of partitions of all positive integers <= n into exactly k consecutive parts, and the square of the total number of partitions of all positive integers < n into exactly k consecutive parts. - _Omar E. Pol_, Feb 14 2018
%C From _Omar E. Pol_, Nov 24 2020: (Start)
%C T(n,k) is also the number of steps in the first n levels of the k-th double-staircase that has at least one step in the n-th level of the "Double- staircases" diagram, otherwise T(n,k) = 0, (see the Example section).
%C For the connection with A280851 see also the algorithm of A280850 and the conjecture of A296508. (End)
%C The number of zeros in the n-th row equals A238005(n). - _Omar E. Pol_, Sep 11 2021
%C Apart from the alternating row sums and the sum of divisors function A000203 another connection with Euler's pentagonal theorem is that in the irregular triangle of A238442 the k-th column starts in the row that is the k-th generalized pentagonal number A001318(k) while here the k-th column starts in the row that is the k-th generalized hexagonal number A000217(k). Both A001318 and A000217 are successive members of the same family: the generalized polygonal numbers. - _Omar E. Pol_, Sep 23 2021
%C Other triangle with the same row lengths and alternating row sums equals sigma(n) is A252117. - _Omar E. Pol_, May 03 2022
%H G. C. Greubel, <a href="/A196020/b196020.txt">Table of n, a(n) for the first 200 rows, flattened</a>
%H Max Alekseyev, <a href="http://list.seqfan.eu/oldermail/seqfan/2013-November/011933.html">Proof of the alternating sum property of A196020</a>, SeqFan Mailing List, Nov 17 2013.
%H Paul D. Hanna, <a href="http://list.seqfan.eu/oldermail/seqfan/2013-November/011935.html">About an identity for sigma</a>, SeqFan Mailing List, Nov 18 2013.
%H <a href="/index/Si#SIGMAN">Index entries for sequences related to sigma(n)</a>
%F A000203(n) = Sum_{k=1..A003056(n)} (-1)^(k-1)*T(n,k).
%F T(n,k) = 2*A211343(n,k) - 1, if A211343(n,k) >= 1 otherwise T(n,k) = 0.
%F If n==k/2 (mod k) and n>=k(k+1)/2, then T(n,k) = 2*n/k - k; otherwise T(n,k) = 0. - _Max Alekseyev_, Nov 18 2013
%F T(n,k) = A236104(n,k) - A236104(n-1,k), assuming that A236104(k*(k+1)/2-1,k) = 0. - _Omar E. Pol_, Oct 14 2018
%F T(n,k) = A237048(n,k)*A338721(n,k). - _Omar E. Pol_, Feb 22 2022
%e Triangle begins:
%e 1;
%e 3;
%e 5, 1;
%e 7, 0;
%e 9, 3;
%e 11, 0, 1;
%e 13, 5, 0;
%e 15, 0, 0;
%e 17, 7, 3;
%e 19, 0, 0, 1;
%e 21, 9, 0, 0;
%e 23, 0, 5, 0;
%e 25, 11, 0, 0;
%e 27, 0, 0, 3;
%e 29, 13, 7, 0, 1;
%e 31, 0, 0, 0, 0;
%e 33, 15, 0, 0, 0;
%e 35, 0, 9, 5, 0;
%e 37, 17, 0, 0, 0;
%e 39, 0, 0, 0, 3;
%e 41, 19, 11, 0, 0, 1;
%e 43, 0, 0, 7, 0, 0;
%e 45, 21, 0, 0, 0, 0;
%e 47, 0, 13, 0, 0, 0;
%e 49, 23, 0, 0, 5, 0;
%e 51, 0, 0, 9, 0, 0;
%e 53, 25, 15, 0, 0, 3;
%e 55, 0, 0, 0, 0, 0, 1;
%e ...
%e For n = 15 the divisors of 15 are 1, 3, 5, 15, so the sum of divisors of 15 is 1 + 3 + 5 + 15 = 24. On the other hand, the 15th row of the triangle is 29, 13, 7, 0, 1, so the alternating row sum is 29 - 13 + 7 - 0 + 1 = 24, equaling the sum of divisors of 15.
%e If n is even then the alternating sum of the n-th row is simpler to evaluate than the sum of divisors of n. For example the sum of divisors of 24 is 1 + 2 + 3 + 4 + 6 + 8 + 12 + 24 = 60, and the alternating sum of the 24th row of triangle is 47 - 0 + 13 - 0 + 0 - 0 = 60.
%e From _Omar E. Pol_, Nov 24 2020: (Start)
%e For an illustration of the rows of triangle consider the infinite "double-staircases" diagram defined in A335616 (see also the theorem there).
%e For n = 15 the diagram with first 15 levels looks like this:
%e .
%e Level "Double-staircases" diagram
%e . _
%e 1 _|1|_
%e 2 _|1 _ 1|_
%e 3 _|1 |1| 1|_
%e 4 _|1 _| |_ 1|_
%e 5 _|1 |1 _ 1| 1|_
%e 6 _|1 _| |1| |_ 1|_
%e 7 _|1 |1 | | 1| 1|_
%e 8 _|1 _| _| |_ |_ 1|_
%e 9 _|1 |1 |1 _ 1| 1| 1|_
%e 10 _|1 _| | |1| | |_ 1|_
%e 11 _|1 |1 _| | | |_ 1| 1|_
%e 12 _|1 _| |1 | | 1| |_ 1|_
%e 13 _|1 |1 | _| |_ | 1| 1|_
%e 14 _|1 _| _| |1 _ 1| |_ |_ 1|_
%e 15 |1 |1 |1 | |1| | 1| 1| 1|
%e .
%e The first largest double-staircase has 29 horizontal steps, the second double-staircase has 13 steps, the third double-staircase has 7 steps, and the fifth double-staircases has only one step. Note that the fourth double-staircase does not count because it does not have horizontal steps in the 15th level, so the 15th row of triangle is [29, 13, 7, 0, 1].
%e For a connection with the "Ziggurat" diagram and the parts and subparts of the symmetric representation of sigma(15) see also A237270. (End)
%p T_row := proc(n) local T;
%p T := (n, k) -> if modp(n-k/2, k) = 0 and n >= k*(k+1)/2 then 2*n/k-k else 0 fi;
%p seq(T(n,k), k=1..floor((sqrt(8*n+1)-1)/2)) end:
%p seq(print(T_row(n)),n=1..24); # _Peter Luschny_, Oct 27 2015
%t T[n_, k_] := If[Mod[n - k*(k+1)/2, k] == 0 ,2*n/k - k, 0]
%t row[n_] := Floor[(Sqrt[8n+1]-1)/2]
%t line[n_] := Map[T[n, #]&, Range[row[n]]]
%t a196020[m_, n_] := Map[line, Range[m, n]]
%t Flatten[a196020[1,22]] (* data *)
%t (* _Hartmut F. W. Hoft_, Oct 26 2015 *)
%t A196020row = Function[n,Table[If[Divisible[Numerator[n-k/2],k] && CoprimeQ[ Denominator[n- k/2], k],2*n/k-k,0],{k,1,Floor[(Sqrt[8 n+1]-1)/2]}]]
%t Flatten[Table[A196020row[n], {n,1,24}]] (* _Peter Luschny_, Oct 28 2015 *)
%o (Sage)
%o def T(n,k):
%o q = (2*n-k)/2
%o b = k.divides(q.numerator()) and gcd(k,q.denominator()) == 1
%o return 2*n/k - k if b else 0
%o for n in (1..24): [T(n, k) for k in (1..floor((sqrt(8*n+1)-1)/2))] # _Peter Luschny_, Oct 28 2015
%Y Columns 1-2: A005408, A193356.
%Y Compare with A027750, A238442, A237270, A237273, A252117, A280851, A296508.
%Y Cf. A000203, A000217, A001227, A001318, A003056, A211343, A212119, A228813, A231345, A231347, A235791, A235794, A236104, A236106, A236112, A237048, A237271, A237591, A237593, A238005, A239660, A244050, A245092, A261699, A262626, A286000, A286001, A280850, A335616, A338721.
%K nonn,tabf
%O 1,2
%A _Omar E. Pol_, Feb 02 2013