OFFSET
1,5
COMMENTS
n does not divide a(n) iff n = (2^k)*(q^m) with k > 0, m >= 0 and q odd prime such that q == 3 (mod 4) or n = (2^k)*(3^L)*Product_{q} q^(v_q) with k >= 0, L > 0, v_q >= 0 and all q odd primes such that q == 5 (mod 6). - René Gy, Oct 21 2018
LINKS
Seiichi Manyama, Table of n, a(n) for n = 1..10000
John D. Baum, A Number-Theoretic Sum, Mathematics Magazine 55.2 (1982): 111-113.
René Gy, The sum of product pairs of integers prime to n, Math StackExchange.
MAPLE
R:=proc(n, k) local x, t1, S;
t1:={}; S:=0;
for x from 1 to floor(n/2) do if gcd(x, n)=1 then t1:={op(t1), x^k}; S:=S+x^k; fi; od;
S; end;
s:=k->[seq(R(n, k), n=1..50)];
s(2);
MATHEMATICA
f[n_] := Plus @@ (Select[ Range[n/2], GCD[#, n] == 1 &]^2); Array[f, 50] (* Robert G. Wilson v, Dec 10 2017 *)
PROG
(PARI) a(n) = sum(j=1, n\2, (gcd(j, n)==1)*j^2); \\ Michel Marcus, Dec 10 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Dec 08 2017
STATUS
approved