OFFSET
1,2
COMMENTS
The order of a matrix M over Z/(nZ) is the smallest k such that M^k is idempotent.
REFERENCES
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..150 (first 61 terms from Sean A. Irvine)
Michael S. Branicky, Python program
A. Wilansky, Spectral decomposition of matrices for high school students, Math. Mag., vol. 41, 1968, pp. 51-59.
A. Wilansky, Spectral decomposition of matrices for high school students, Math. Mag., vol. 41, 1968, pp. 51-59. (Annotated scanned copy)
A. Wilansky, Letters to N. J. A. Sloane, Jun. 1991.
PROG
(PARI) order(m) = {kk = 1; ok = 0; while (! ok, mk = m^kk; if (mk^2 == mk, ok = 1, kk++); ); return(kk); }
a(n) = {ret = 0; m = matrix(2, 2); for (i=0, n-1, m[1, 1] = Mod(i, n); for (j=0, n-1, m[1, 2] = Mod(j, n); for (k=0, n-1, m[2, 1] = Mod(k, n); for (l=0, n-1, m[2, 2] = Mod(l, n); ret += order(m); ); ); ); ); return (ret); }
(Python) # see link for faster version
from itertools import product
def mmm2(A, B, modder): # matrix multiply modulo for 2x2
return ((A[0]*B[0]+A[1]*B[2])%modder, (A[0]*B[1]+A[1]*B[3])%modder,
(A[2]*B[0]+A[3]*B[2])%modder, (A[2]*B[1]+A[3]*B[3])%modder)
def order(A, modder):
Ak, k = A, 1
while mmm2(Ak, Ak, modder) != Ak: Ak, k = mmm2(Ak, A, modder), k+1
return k
def a(n): return sum(order(A, n) for A in product(range(n), repeat=4))
print([a(n) for n in range(1, 12)]) # Michael S. Branicky, Jan 26 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Albert Wilansky
EXTENSIONS
The article gives an incorrect value for a(5).
More terms from Michel Marcus, Jun 07 2013
More terms from Sean A. Irvine, Dec 18 2016
STATUS
approved