OFFSET
1,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Prime Sum
FORMULA
Theorem: a(n) = Sum_{i=1..p-1, j=1..p-1} floor(i*j/p). The proof is based on the formula for p-g-c-d of Marcelo Polezzi. - Jean-Claude Babois
a(n) == 0 (mod 3) for n >= 3. - Hugo Pfoertner, Aug 23 2021
MAPLE
a:= n-> (p-> ((p-1)^3-(p-1)^2)/4)(ithprime(n)):
seq(a(n), n=1..40); # Alois P. Heinz, Feb 05 2020
MATHEMATICA
Table[((Prime[n] - 1)^3 - (Prime[n] - 1)^2)/4, {n, 20}] (* Eric W. Weisstein, Aug 22 2021 *)
Table[((Prime[n] - 2) (Prime[n] - 1)^2)/4, {n, 20}] (* Eric W. Weisstein, Aug 22 2021 *)
Table[Times @@ (Prime[n] - {1, 1, 2})/4, {n, 20}] (* Eric W. Weisstein, Aug 22 2021 *)
Table[Sum[Floor[i j/Prime[n]], {i, Prime[n] - 1}, {j, Prime[n] - 1}], {n, 20}] (* Eric W. Weisstein, Aug 22 2021 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Feb 05 2020 following a suggestion from Jean-Claude Babois.
STATUS
approved