A160255 The sum of all the entries in an n X n Cayley table for multiplication in Z_n.
0, 1, 6, 16, 40, 63, 126, 176, 270, 365, 550, 624, 936, 1099, 1350, 1664, 2176, 2349, 3078, 3280, 3948, 4631, 5566, 5712, 7000, 7813, 8748, 9520, 11368, 11475, 13950, 14592, 16236, 17969, 19390, 20304, 23976, 25327, 27222, 28400, 32800, 32949, 37926, 38896
Offset: 1
Keywords
Examples
For n=4: | 0 1 2 3 -+-------- 0| 0 0 0 0 1| 0 1 2 3 2| 0 2 0 2 3| 0 3 2 1 Sum becomes 6+4+6 = 16.
Programs
-
PARI
a(n) = (n/2)*sum(i=1, n-1, gcd(n, i)*(n/gcd(n, i)-1)); \\ Michel Marcus, Jun 16 2013 [edited by Richard L. Ollerton, May 06 2021]
Formula
a(p) = (p-1)*(p^2-p)/2, for p prime.
a(n) = (n/2)*Sum_{i=1..n-1} gcd(n,i)*(n/gcd(n,i)-1). [Edited by Richard L. Ollerton, May 06 2021]
a(n) = (n^2/2)*Sum_{d|n} phi(d)*(d-1)/d, where phi = A000010. - Richard L. Ollerton, May 06 2021
From Ridouane Oudra, Aug 24 2022: (Start)
a(n) = Sum_{i=1..n} Sum_{j=1..n} (i*j mod n);
a(n) = n^3/2 - (n/2)*Sum_{i=1..n} gcd(n,i);
a(n) = n^3/2 - (n/2)*Sum_{d|n} d*tau(d)*moebius(n/d);
Extensions
More terms from Carl Najafi, Sep 29 2011
Comments