login
A177895
Trace of the square matrix whose rows are the cyclic permutations of the digits of n.
1
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, 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, 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
OFFSET
0,3
FORMULA
For n=a, trace(M) = a;
for n=ab, trace(M) = 2a;
for n=abc, trace(M) = a + b + c;
for n=abcd, trace(M) = 2a + 2c.
EXAMPLE
a(123) = 6, because M =
[1 2 3]
[2 3 1]
[3 1 2]
and trace(M) = 6.
PROG
(Sage)
def A177895(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.trace() # 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]); trace(m)} \\ David A. Corneth, Jun 13 2017
CROSSREFS
Sequence in context: A344486 A138795 A297233 * A340184 A238986 A227876
KEYWORD
nonn,base
AUTHOR
Michel Lagneau, Dec 15 2010
STATUS
approved