login
Trace of the square matrix whose rows are the cyclic permutations of the digits of n.
1

%I #19 Mar 14 2020 13:02:13

%S 0,1,2,3,4,5,6,7,8,9,2,2,2,2,2,2,2,2,2,2,4,4,4,4,4,4,4,4,4,4,6,6,6,6,

%T 6,6,6,6,6,6,8,8,8,8,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,12,12,

%U 12,12,12,12,12,12,12,12,14,14,14,14,14,14,14,14,14,14,16,16,16,16,16,16,16,16,16,16,18,18,18,18,18,18,18,18,18,18,1,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,11,3,4,5,6,7,8,9,10,11,12,4,5,6,7,8,9,10,11,12,13,5,6,7,8,9,10,11,12

%N Trace of the square matrix whose rows are the cyclic permutations of the digits of n.

%F For n=a, trace(M) = a;

%F for n=ab, trace(M) = 2a;

%F for n=abc, trace(M) = a + b + c;

%F for n=abcd, trace(M) = 2a + 2c.

%e a(123) = 6, because M =

%e [1 2 3]

%e [2 3 1]

%e [3 1 2]

%e and trace(M) = 6.

%o (Sage)

%o def A177895(n):

%o d = n.digits()[::-1] if n > 0 else [0]

%o M = Matrix(lambda i,j: d[(i+j) % len(d)], nrows=len(d))

%o return M.trace() # _D. S. McNeil_, Dec 16 2010

%o (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]); trace(m)} \\ _David A. Corneth_, Jun 13 2017

%K nonn,base

%O 0,3

%A _Michel Lagneau_, Dec 15 2010