login
Triangle read by rows, where row (n) = n mod (n-1), n mod (n-2), n mod (n-3), ...n mod 2.
8

%I #19 Jul 18 2024 05:33:40

%S 1,1,0,1,2,1,1,2,0,0,1,2,3,1,1,1,2,3,0,2,0,1,2,3,4,1,0,1,1,2,3,4,0,2,

%T 1,0,1,2,3,4,5,1,3,2,1,1,2,3,4,5,0,2,0,0,0,1,2,3,4,5,6,1,3,1,1,1,1,2,

%U 3,4,5,6,0,2,4,2,2,0,1,2,3,4,5,6,7,1,3,0,3,0,1,1,2,3,4,5,6,7,0,2,4,1,0,1,0

%N Triangle read by rows, where row (n) = n mod (n-1), n mod (n-2), n mod (n-3), ...n mod 2.

%C Central terms: a(2*n+1,n) = n for n > 0. - _Reinhard Zumkeller_, Dec 03 2014

%C Deleting column 1 of the array at A051126 gives the array A051778 in square format (see Example). - _Clark Kimberling_, Feb 04 2016

%H Reinhard Zumkeller, <a href="/A051778/b051778.txt">Rows n=3..125 of triangle, flattened</a>

%e row (7) = 7 mod 6, 7 mod 5, 7 mod 4, 7 mod 3, 7 mod 2 = 1, 2, 3, 1, 1.

%e 1;

%e 1 0 ;

%e 1 2 1 ;

%e 1 2 0 0 ;

%e 1 2 3 1 1 ;

%e 1 2 3 0 2 0 ;

%e 1 2 3 4 1 0 1 ;

%e 1 2 3 4 0 2 1 0 ;

%e 1 2 3 4 5 1 3 2 1 ;

%e 1 2 3 4 5 0 2 0 0 0 ;

%e 1 2 3 4 5 6 1 3 1 1 1 ;

%e Northwest corner of square array:

%e 1 1 1 1 1 1 1 1 1 1 1

%e 0 2 2 2 2 2 2 2 2 2 2

%e 1 0 3 3 3 3 3 3 3 3 3

%e 0 1 0 4 4 4 4 4 4 4 4

%e 1 2 1 0 5 5 5 5 5 5 5

%e 0 0 2 1 0 6 6 6 6 6 6

%e 1 1 3 2 1 0 7 7 7 7 7

%e - _Clark Kimberling_, Feb 04 2016

%t Flatten[Table[Mod[n,i],{n,3,20},{i,n-1,2,-1}]] (* _Harvey P. Dale_, Sep 09 2012 *)

%t TableForm[Table[Mod[n, k], {n, 1, 12}, {k, 2, 12}]] (* square *)

%t (* _Clark Kimberling_, Feb 04 2016 *)

%o (Haskell)

%o a051778 n k = a051778_tabl !! (n-3) !! (k-1)

%o a051778_row n = a051778_tabl !! (n-3)

%o a051778_tabl = map (\xs -> map (mod (head xs + 1)) xs) $

%o iterate (\xs -> (head xs + 1) : xs) [2]

%o -- _Reinhard Zumkeller_, Dec 03 2014

%Y Cf. A051777, A051127, A051126.

%Y Cf. A004125 (row sums), A000027 (central terms), A049820 (number of nonzeros per row), A032741 (number of ones per row), A070824 (number of zeros per row).

%K easy,nice,nonn,tabl

%O 3,5

%A _Asher Auel_, Dec 09 1999