cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A204022 Symmetric matrix based on f(i,j) = max(2i-1, 2j-1), by antidiagonals.

This page as a plain text file.
%I A204022 #30 Jun 09 2025 00:53:07
%S A204022 1,3,3,5,3,5,7,5,5,7,9,7,5,7,9,11,9,7,7,9,11,13,11,9,7,9,11,13,15,13,
%T A204022 11,9,9,11,13,15,17,15,13,11,9,11,13,15,17,19,17,15,13,11,11,13,15,17,
%U A204022 19,21,19,17,15,13,11,13,15,17,19,21,23,21,19,17,15,13,13,15,17,19,21,23
%N A204022 Symmetric matrix based on f(i,j) = max(2i-1, 2j-1), by antidiagonals.
%C A204022 This sequence represents the matrix M given by f(i,j) = max(2i-1, 2j-1) for i >= 1 and j >= 1. See A204023 for characteristic polynomials of principal submatrices of M, with interlacing zeros. See A204016 for a guide to other choices of M.
%H A204022 G. C. Greubel, <a href="/A204022/b204022.txt">Rows n = 1..100 of triangle, flattened</a>
%F A204022 From _Ridouane Oudra_, May 27 2019: (Start)
%F A204022 a(n) = t + |t^2-2n+1|, where t = floor(sqrt(2n-1)+1/2).
%F A204022 a(n) = A209302(2n-1).
%F A204022 a(n) = A002024(n) + |A002024(n)^2-2n+1|.
%F A204022 a(n) = t + |t^2-2n+1|, where t = floor(sqrt(2n)+1/2). (End)
%e A204022 Northwest corner:
%e A204022   1 3 5 7 9
%e A204022   3 3 5 7 9
%e A204022   5 5 5 7 9
%e A204022   7 7 7 7 9
%e A204022   9 9 9 9 9
%t A204022 (* First program *)
%t A204022 f[i_, j_] := Max[2 i - 1, 2 j - 1];
%t A204022 m[n_] := Table[f[i, j], {i, n}, {j, n}]
%t A204022 TableForm[m[6]] (* 6 X 6 principal submatrix *)
%t A204022 Flatten[Table[f[i, n + 1 - i],
%t A204022   {n, 15}, {i, n}]]                (* A204022 *)
%t A204022 p[n_] := CharacteristicPolynomial[m[n], x];
%t A204022 c[n_] := CoefficientList[p[n], x]
%t A204022 TableForm[Flatten[Table[p[n], {n, 10}]]]
%t A204022 Table[c[n], {n, 12}]
%t A204022 Flatten[%]                         (* A204023 *)
%t A204022 TableForm[Table[c[n], {n, 10}]]
%t A204022 (* Second program *)
%t A204022 Table[Max[2*k-1, 2*(n-k)+1], {n, 12}, {k, n}]//Flatten (* _G. C. Greubel_, Jul 23 2019 *)
%o A204022 (PARI) {T(n, k) = max(2*k-1, 2*(n-k)+1)};
%o A204022 for(n=1, 12, for(k=1, n, print1(T(n, k), ", "))) \\ _G. C. Greubel_, Jul 23 2019
%o A204022 (Magma) [[Max(2*k-1, 2*(n-k)+1): k in [1..n]]: n in [1..12]]; // _G. C. Greubel_, Jul 23 2019
%o A204022 (Sage) [[max(2*k-1, 2*(n-k)+1) for k in (1..n)] for n in (1..12)] # _G. C. Greubel_, Jul 23 2019
%o A204022 (GAP) Flat(List([1..12], n-> List([1..n], k-> Maximum(2*k-1, 2*(n-k)+1) ))); # _G. C. Greubel_, Jul 23 2019
%o A204022 (Python)
%o A204022 from math import isqrt
%o A204022 def A204022(n): return (m:=isqrt(n<<3)+1>>1)+abs(m**2-(n<<1)+1) # _Chai Wah Wu_, Jun 08 2025
%Y A204022 Cf. A202453, A204016, A204022, A209302.
%K A204022 nonn,tabl
%O A204022 1,2
%A A204022 _Clark Kimberling_, Jan 11 2012