OFFSET
1,2
COMMENTS
a(p) = p^2*(p-1)/2 + 1, p is prime.
a(p^k) = p^(k+1)*(p^k-1)/2 + 1 if p is prime and k >= 1. - Robert Israel, May 21 2015
LINKS
Ivan Neretin, Table of n, a(n) for n = 1..1000
MAPLE
A:= proc(n) local L;
L:= select(t->igcd(t, n)>1, [$1..n^2])[1 .. n-1];
1+convert(L, `+`)
end proc:
seq(A(n), n=1..100); # Robert Israel, May 21 2015
MATHEMATICA
Table[Plus @@ Join[{1}, Select[Range[n^2], GCD[n, #] > 1 &, n - 1]], {n, 1, 47}](* Ivan Neretin, May 21 2015 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Mar 27 2003
EXTENSIONS
More terms from Ryan Propper, Nov 05 2005
STATUS
approved