%I #33 Dec 07 2019 12:18:28
%S 1,5,4,12,11,9,22,21,19,16,35,34,32,29,25,51,50,48,45,41,36,70,69,67,
%T 64,60,55,49,92,91,89,86,82,77,71,64,117,116,114,111,107,102,96,89,81,
%U 145,144,142,139,135,130,124,117,109,100,176,175,173,170,166,161,155,148,140,131,121,210,209
%N Triangular array read by rows, demonstrating that the difference between a pentagonal number (left edge of triangle) and a square (right edge) is a triangular number.
%F P(m,n) = (m(3m-1) - n(n-1))/2. Alternatively, P(n) - T(n-1) = S(n) where P(n) is a pentagonal number, T(n-1) is a triangular number, and S(n) is a square number.
%e Rows: {1}; {5,4}; {12,11,9}; ...
%e Triangle begins:
%e 1
%e 5 4
%e 12 11 9
%e 22 21 19 16
%e 35 34 32 29 25
%p A284551 := proc(n,m)
%p n*(3*n-1)-m*(m-1) ;
%p %/2 ;
%p end proc:
%p seq(seq(A284551(n,m),m=1..n),n=1..15) ; # _R. J. Mathar_, Mar 30 2017
%t T[n_,m_]:= Floor[n(3n - 1) - m(m - 1)]/2; Table[T[n, k], {n, 12}, {k, n}] // Flatten (* _Indranil Ghosh_, Mar 30 2017 *)
%o (PARI) T(n,m) = floor(n*(3*n - 1) - m*(m - 1))/2;
%o for(n=1, 12, for(k=1, n, print1(T(n,k),", ");); print();); \\ _Indranil Ghosh_, Mar 30 2017
%o (Python)
%o def T(n, m): return (n*(3*n - 1) - m*(m - 1))/2
%o for n in range(1, 13):
%o ....print [T(n,k) for k in range(1, n + 1)] # _Indranil Ghosh_, Mar 30 2017
%Y Cf. A049777, A049780, which have a similar layout based on subtracting triangular numbers of increasing value from the leftmost element of the row.
%Y A051662 gives row sums.
%K nonn,tabl,easy
%O 1,2
%A _David Shane_, Mar 29 2017