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.

Original entry on oeis.org

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, 11, 9, 9, 11, 13, 15, 17, 15, 13, 11, 9, 11, 13, 15, 17, 19, 17, 15, 13, 11, 11, 13, 15, 17, 19, 21, 19, 17, 15, 13, 11, 13, 15, 17, 19, 21, 23, 21, 19, 17, 15, 13, 13, 15, 17, 19, 21, 23
Offset: 1

Views

Author

Clark Kimberling, Jan 11 2012

Keywords

Comments

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.

Examples

			Northwest corner:
  1 3 5 7 9
  3 3 5 7 9
  5 5 5 7 9
  7 7 7 7 9
  9 9 9 9 9
		

Crossrefs

Programs

  • GAP
    Flat(List([1..12], n-> List([1..n], k-> Maximum(2*k-1, 2*(n-k)+1) ))); # G. C. Greubel, Jul 23 2019
    
  • Magma
    [[Max(2*k-1, 2*(n-k)+1): k in [1..n]]: n in [1..12]]; // G. C. Greubel, Jul 23 2019
    
  • Mathematica
    (* First program *)
    f[i_, j_] := Max[2 i - 1, 2 j - 1];
    m[n_] := Table[f[i, j], {i, n}, {j, n}]
    TableForm[m[6]] (* 6 X 6 principal submatrix *)
    Flatten[Table[f[i, n + 1 - i],
      {n, 15}, {i, n}]]                (* A204022 *)
    p[n_] := CharacteristicPolynomial[m[n], x];
    c[n_] := CoefficientList[p[n], x]
    TableForm[Flatten[Table[p[n], {n, 10}]]]
    Table[c[n], {n, 12}]
    Flatten[%]                         (* A204023 *)
    TableForm[Table[c[n], {n, 10}]]
    (* Second program *)
    Table[Max[2*k-1, 2*(n-k)+1], {n, 12}, {k, n}]//Flatten (* G. C. Greubel, Jul 23 2019 *)
  • PARI
    {T(n, k) = max(2*k-1, 2*(n-k)+1)};
    for(n=1, 12, for(k=1, n, print1(T(n, k), ", "))) \\ G. C. Greubel, Jul 23 2019
    
  • Python
    from math import isqrt
    def A204022(n): return (m:=isqrt(n<<3)+1>>1)+abs(m**2-(n<<1)+1) # Chai Wah Wu, Jun 08 2025
  • 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
    

Formula

From Ridouane Oudra, May 27 2019: (Start)
a(n) = t + |t^2-2n+1|, where t = floor(sqrt(2n-1)+1/2).
a(n) = A209302(2n-1).
a(n) = A002024(n) + |A002024(n)^2-2n+1|.
a(n) = t + |t^2-2n+1|, where t = floor(sqrt(2n)+1/2). (End)