login
A157454
Triangle read by rows: T(n, m) = min(2*m - 1, 2*(n - m) + 1).
6
1, 1, 1, 1, 3, 1, 1, 3, 3, 1, 1, 3, 5, 3, 1, 1, 3, 5, 5, 3, 1, 1, 3, 5, 7, 5, 3, 1, 1, 3, 5, 7, 7, 5, 3, 1, 1, 3, 5, 7, 9, 7, 5, 3, 1, 1, 3, 5, 7, 9, 9, 7, 5, 3, 1, 1, 3, 5, 7, 9, 11, 9, 7, 5, 3, 1
OFFSET
1,5
LINKS
FORMULA
T(n,m) = T(n,n-m) = 2*m-1 for 0 <= m <= n/2, otherwise 2*(n-m)+1.
a(n) = 2*A003983(n) - 1.
From Ridouane Oudra, Jul 20 2019: (Start)
a(n) = A002024(n) - A049581(n-1).
a(n) = t - abs(t^2-2n+1), where t = floor(sqrt(2n)+1/2). (End)
EXAMPLE
Triangle starts:
1;
1, 1;
1, 3, 1;
1, 3, 3, 1;
1, 3, 5, 3, 1;
1, 3, 5, 5, 3, 1;
1, 3, 5, 7, 5, 3, 1;
1, 3, 5, 7, 7, 5, 3, 1;
1, 3, 5, 7, 9, 7, 5, 3, 1;
1, 3, 5, 7, 9, 9, 7, 5, 3, 1;
1, 3, 5, 7, 9, 11, 9, 7, 5, 3, 1;
...
MATHEMATICA
Table[Min[2*k-1, 2*(n-k)+1], {n, 1, 12}, {k, 1, n}]//Flatten (* modified by G. C. Greubel, Jun 30 2019 *)
PROG
(Haskell)
import Data.List (inits)
a157454 n k = a157454_tabl !! (n-1) !! (k-1)
a157454_row n = a157454_tabl !! (n-1)
a157454_tabl = concatMap h $ tail $ inits [1, 3 ..] where
h xs = [xs ++ tail xs', xs ++ xs'] where xs' = reverse xs
-- Reinhard Zumkeller, Dec 15 2013
(PARI) {T(n, k) = min(2*k-1, 2*(n-k)+1)};
for(n=1, 12, for(k=1, n, print1(T(n, k), ", "))) \\ G. C. Greubel, Jun 30 2019
(Magma) [[Min(2*k-1, 2*(n-k)+1): k in [1..n]]: n in [1..12]]; // G. C. Greubel, Jun 30 2019
(Sage) [[min(2*k-1, 2*(n-k)+1) for k in (1..n)] for n in (1..12)] # G. C. Greubel, Jun 30 2019
(GAP) Flat(List([1..12], n-> List([1..n], k-> Minimum(2*k-1, 2*(n-k)+1) ))) # G. C. Greubel, Jun 30 2019
CROSSREFS
Row sums are A000982(n).
Sequence in context: A132429 A046540 A123191 * A106255 A143086 A327481
KEYWORD
nonn,easy,tabl
AUTHOR
Roger L. Bagula, Mar 01 2009
EXTENSIONS
Edited by the Associate Editors of the OEIS, Apr 10 2009
STATUS
approved