A given nonnegative integer is transformed into a square matrix whose order equals the quantity of the number's digits. Each element of the main diagonal is a digit of this original number, while other elements are calculated from this diagonal. The determinant of this matrix is the element of the sequence.
a(n) = det(B) where B is the n X n matrix with B(i,i) given by the i-th digit of n, B(i,j) = abs(B(i,j-1)-B(i+1,j)) if i < j and B(i,j) = B(i-1,j) + B(i,j+1) if i > j.
EXAMPLE
For n=124, a(124)=2, as follows:
B(1,1) = 1;
B(2,2) = 2;
B(3,3) = 4;
B(1,2) = abs(B(1,1) - B(2,2)) = abs(1-2) = 1;
B(2,3) = abs(B(2,2) - B(3,3)) = abs(2-4) = 2;
B(1,3) = abs(B(1,2) - B(2,3)) = abs(1-1) = 1;
B(2,1) = B(1,1) + B(2,2) = 1 + 2 = 3;
B(3,2) = B(2,2) + B(3,3) = 2 + 4 = 6;
B(3,1) = B(2,1) + B(3,2) = 3 + 6 = 9.
Thus,
_______|1 1 1|
B(124)=|3 2 2| --> det(B(124)) = a(124) = 2.
_______|9 6 4|
CROSSREFS
See A227876, since the process of matrix construction is this so-called "pyramidalization".