This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A160255 #42 Sep 28 2022 04:11:22 %S A160255 0,1,6,16,40,63,126,176,270,365,550,624,936,1099,1350,1664,2176,2349, %T A160255 3078,3280,3948,4631,5566,5712,7000,7813,8748,9520,11368,11475,13950, %U A160255 14592,16236,17969,19390,20304,23976,25327,27222,28400,32800,32949,37926,38896 %N A160255 The sum of all the entries in an n X n Cayley table for multiplication in Z_n. %C A160255 Thanks to David Miller. %F A160255 a(p) = (p-1)*(p^2-p)/2, for p prime. %F A160255 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] %F A160255 a(n) = (n^2/2)*Sum_{d|n} phi(d)*(d-1)/d, where phi = A000010. - _Richard L. Ollerton_, May 06 2021 %F A160255 From _Ridouane Oudra_, Aug 24 2022: (Start) %F A160255 a(n) = Sum_{i=1..n} Sum_{j=1..n} (i*j mod n); %F A160255 a(n) = n^3/2 - (n/2)*Sum_{i=1..n} gcd(n,i); %F A160255 a(n) = n^3/2 - (n/2)*Sum_{d|n} d*tau(d)*moebius(n/d); %F A160255 a(n) = (A000578(n) - n*A018804(n))/2. (End) %e A160255 For n=4: %e A160255 | 0 1 2 3 %e A160255 -+-------- %e A160255 0| 0 0 0 0 %e A160255 1| 0 1 2 3 %e A160255 2| 0 2 0 2 %e A160255 3| 0 3 2 1 %e A160255 Sum becomes 6+4+6 = 16. %o A160255 (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] %Y A160255 Cf. A000010, A000578, A018804. %K A160255 nonn %O A160255 1,3 %A A160255 David Byrne (david.roggeveen.byrne(AT)gmail.com), May 06 2009 %E A160255 More terms from _Carl Najafi_, Sep 29 2011