%I #69 May 07 2023 08:28:20
%S 0,0,0,0,1,0,0,1,1,0,0,1,2,1,0,0,1,2,2,1,0,0,1,2,3,2,1,0,0,1,2,3,3,2,
%T 1,0,0,1,2,3,4,3,2,1,0,0,1,2,3,4,4,3,2,1,0,0,1,2,3,4,5,4,3,2,1,0,0,1,
%U 2,3,4,5,5,4,3,2,1,0,0,1,2,3,4,5,6,5,4,3,2,1,0,0,1,2,3,4,5,6,6,5,4,3,2,1,0,0,1,2
%N Triangle read by rows. T(n, k) = n - k if n - k < k, otherwise k.
%C Table of min(x,y), where (x,y) = (0,0),(0,1),(1,0),(0,2),(1,1),(2,0),...
%C Highest power of 6 that divides A036561. - _Fred Daniel Kline_, May 29 2012
%C Triangle T(n,k) read by rows: T(n,k) = min(k,n-k). - _Philippe Deléham_, Feb 25 2014
%H Reinhard Zumkeller, <a href="/A004197/b004197.txt">Rows n=0..100 of triangle, flattened</a>
%F a(n) = A003983(n) - 1.
%F G.f.: x*y/((1-x)*(1-y)*(1-x*y)). - _Franklin T. Adams-Watters_, Feb 06 2006
%F 2^T(n,k) = A144464(n,k), 3^T(n,k) = A152714(n,k), 4^T(n,k) = A152716(n,k), 5^T(n,k) = A152717(n,k). - _Philippe Deléham_, Feb 25 2014
%F a(n) = (1/2)*(t - 1 - abs(t^2 - 2*n - 1)), where t = floor(sqrt(2*n+1)+1/2). - _Ridouane Oudra_, May 03 2019
%e From _Philippe Deléham_, Feb 25 2014: (Start)
%e Top left corner of table:
%e 0 0 0 0
%e 0 1 1 1
%e 0 1 2 2
%e 0 1 2 3
%e Triangle T(n,k) begins:
%e 0;
%e 0, 0;
%e 0, 1, 0;
%e 0, 1, 1, 0;
%e 0, 1, 2, 1, 0;
%e 0, 1, 2, 2, 1, 0;
%e 0, 1, 2, 3, 2, 1, 0;
%e 0, 1, 2, 3, 3, 2, 1, 0;
%e 0, 1, 2, 3, 4, 3, 2, 1, 0;
%e 0, 1, 2, 3, 4, 4, 3, 2, 1, 0;
%e 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0;
%e 0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0;
%e 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0;
%e 0, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 0;
%e 0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 0;
%e 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0;
%e ... (End)
%p T := (n, k) -> if n - k < k then n - k else k fi:
%p for n from 0 to 9 do seq(T(n, k), k=0..n) od; # _Peter Luschny_, May 07 2023
%t Flatten[Table[IntegerExponent[2^(n - k) 3^k, 6], {n, 0, 20}, {k, 0, n}]] (* _Fred Daniel Kline_, May 29 2012 *)
%o (Haskell)
%o a004197 n k = a004197_tabl !! n !! k
%o a004197_tabl = map a004197_row [0..]
%o a004197_row n = hs ++ drop (1 - n `mod` 2) (reverse hs)
%o where hs = [0..n `div` 2]
%o -- _Reinhard Zumkeller_, Aug 14 2011
%o (PARI) T(x,y)=min(x,y) \\ _Charles R Greathouse IV_, Feb 07 2017
%Y Similar to but strictly different from A087062 and A261684.
%Y Row sums give A002620. - _Reinhard Zumkeller_, Jul 27 2005
%Y Positions of zero are given in A117142. - _Ridouane Oudra_, Apr 30 2019
%Y Cf. A144464, A152714, A152716, A152717.
%K tabl,nonn,easy,nice
%O 0,13
%A _David W. Wilson_
%E Mathematica program fixed by _Harvey P. Dale_, Nov 26 2020
%E Name edited by _Peter Luschny_, May 07 2023