OFFSET
0,3
LINKS
David A. Corneth, Table of n, a(n) for n = 0..9999
FORMULA
For n = a, det(M) = a;
for n = ab, det(M) = a^2 - b^2;
for n = abc, det(M) = 3abc - a^3 - b^3 - c^3; ...
EXAMPLE
for n=104, the (3 X 3) matrix M is
[1 0 4]
[0 4 1]
[4 1 0]
and a(104) = det(M) = -65.
MATHEMATICA
A177894[n_] := If[n < 10, n, Det[NestList[RotateLeft, IntegerDigits[n], IntegerLength[n]-1]]]; Array[A177894, 100, 0] (* Paolo Xausa, Mar 11 2024 *)
PROG
(Sage)
def A177894(n):
d = n.digits()[::-1] if n > 0 else [0]
M = Matrix(lambda i, j: d[(i+j) % len(d)], nrows=len(d))
return M.determinant() # D. S. McNeil, Dec 16 2010
(PARI) a(n) = {if(n<10, return(n)); my(d = digits(n), m, s); d = concat(d, d); s = #d/2; m = matrix(s, s, i, j, d[i+j-1]); matdet(m)} \\ David A. Corneth, Jun 12 2017
CROSSREFS
KEYWORD
AUTHOR
Michel Lagneau, Dec 15 2010
STATUS
approved