login
Triangle read by rows: row n consists of n followed by (n-2) ones then n.
14

%I #25 Nov 07 2024 15:23:34

%S 1,2,2,3,1,3,4,1,1,4,5,1,1,1,5,6,1,1,1,1,6,7,1,1,1,1,1,7,8,1,1,1,1,1,

%T 1,8,9,1,1,1,1,1,1,1,9,10,1,1,1,1,1,1,1,1,10,11,1,1,1,1,1,1,1,1,1,11,

%U 12,1,1,1,1,1,1,1,1,1,1,12,13,1,1,1,1,1,1,1,1,1,1,1,13,14,1,1,1,1,1,1,1,1,1,1,1,1,14

%N Triangle read by rows: row n consists of n followed by (n-2) ones then n.

%F T(n,k) = A130296(n,k) + A051340(k-1,n-k) - 1.

%F T(n,1) = T(n,n) = n for n >= 1, and T(n,k) = 1 for 2 <= k <= n - 1, n >= 3.

%F From _Franck Maminirina Ramaharo_, Dec 19 2018: (Start)

%F T(n,k) = A130296(n,k) + A130296(n,n-k+1) - 1.

%F G.f.: y*(x - 3*x^2*y^2 + (x^2 + x^3)*y^3)/((1 - y)^2*(1 - x*y)^2).

%F E.g.f.: (1 - x^2 +(x^2 + (x - x^2)*y)*exp(y) - (1 - (x - x^2)*y)*exp(x*y))/(1 - x). (End)

%e First few rows of the triangle are:

%e 1;

%e 2, 2;

%e 3, 1, 3;

%e 4, 1, 1, 4;

%e 5, 1, 1, 1, 5;

%e 6, 1, 1, 1, 1, 6;

%e 7, 1, 1, 1, 1, 1, 7;

%e ...

%p A131821 := proc(n,c) if c=1 or c=n then n ; else 1 ; fi ; end: for n from 1 to 16 do for c from 1 to n do printf("%d,",A131821(n,c)) ; od: od: # _R. J. Mathar_, May 30 2008

%t T[n_, k_] := If[k == 1 || k == n, n, 1];

%t Table[T[n, k], {n, 1, 14}, {k, 1, n}] // Flatten (* _Jean-François Alcover_, May 05 2023 *)

%o (Maxima) T(n,k) := if k = 1 or k = n then n else 1$

%o create_list(T(n, k), n, 1, 12, k, 1, n); /* _Franck Maminirina Ramaharo_, Dec 19 2018 */

%o (Python)

%o from math import isqrt

%o def A131821(n): return m+(k>r) if 0<=(k:=n<<1)-(r:=(m:=isqrt(k))*(m+1))<=2 or n<=2 else 1 # _Chai Wah Wu_, Nov 07 2024

%Y Row sums: A016777.

%Y Cf. A130296, A051340, A016777, A131830.

%K nonn,tabl,easy,changed

%O 1,2

%A _Gary W. Adamson_, Jul 19 2007

%E More terms from _R. J. Mathar_, May 30 2008