%I #8 Feb 06 2019 00:34:50
%S 1,3,1,9,4,3,27,13,21,3,81,40,102,24,9,243,121,426,126,99,9,729,364,
%T 1641,552,675,108,27,2187,1093,6015,2193,3681,783,405,27,6561,3280,
%U 21324,8208,17622,4464,3564,432,81,19683,9841,73812,29532,77490,22086
%N Triangle read by rows where the n-th row is the first row of M^n, with M the (n+1)-by-(n+1) matrix with (3,1,3,1,3,1,...) on its main diagonal and (1,3,1,3,1,3,...) on its superdiagonal.
%C Companion triangle A124572 is generated by switching the main diagonal with the superdiagonal. The row sum of row n is 4^n.
%H Nathaniel Johnston, <a href="/A124573/b124573.txt">Table of n, a(n) for n = 0..5000</a>
%e Row 3 = [27, 13, 21, 3] since when n = 3 we have M^3 = [[27, 13, 21, 3], [0, 1, 39, 15], [0, 0, 27, 13], [0, 0, 0, 1]].
%e First few rows of the triangle are:
%e 1;
%e 3, 1;
%e 9, 4, 3;
%e 27, 13, 21, 3;
%e 81, 40, 102, 24, 9;
%e 243, 121, 426, 126, 99, 9;
%e ...
%p with (LinearAlgebra): for n from 0 to 10 do M := Matrix (n+1, (i, j)->`if`(i=j and i mod 2 = 1, 3, `if`(i=j, 1, `if`(i=j-1 and i mod 2 = 1, 1, `if`(i=j-1, 3, 0))))): X := M^n: for m from 0 to n do printf("%d, ",X[1,m+1]): od: od: # _Nathaniel Johnston_, Apr 28 2011
%Y Cf. A124572, A124730, A124731, A000244 (column 1), A003462 (column 2).
%K nonn,easy,tabl
%O 0,2
%A _Gary W. Adamson_ & _Roger L. Bagula_, Nov 04 2006