OFFSET
1,3
COMMENTS
Equal to convolution sum over positive integers, k, where k<=n and gcd(k,n)=1, except in first term, where the convolution sum is 1 instead of 0.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
From Robert Israel, Sep 29 2019: (Start)
If n is prime, a(n) = A000292(n-1).
If n/2 is an odd prime, a(n) = A000292(n-2)/2.
If n/3 is a prime other than 3, a(n) = A000292(n-3)*2*n/(3*(n-2)). (End)
From Ridouane Oudra, Mar 21 2024: (Start)
Sum_{k=1..n} a(k) ~ n^4 / (4*Pi^2). - Amiram Eldar, Apr 11 2024
EXAMPLE
Since 1, 3, 5 and 7 are relatively prime to 8 and are <= 8, a(8) = 1*(8-1) +3*(8-3) +5*(8-5) +7*(8-7) = 44.
MAPLE
f:= proc(n) local i;
2*add(`if`(igcd(i, n)=1, i*(n-i), 0), i=1..n/2)
end proc:
f(2):= 1:
map(f, [$1..100]); # Robert Israel, Sep 29 2019
MATHEMATICA
a[n_] := 2 Sum[Boole[CoprimeQ[k, n]] k (n - k), {k, 1, n/2}];
a[2] = 1;
Array[a, 100] (* Jean-François Alcover, Aug 16 2020, after Maple *)
PROG
(PARI) a(n) = sum(k=1, n, if (gcd(n, k)==1, k*(n-k))); \\ Michel Marcus, Sep 29 2019
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Leroy Quet, Nov 04 2000
STATUS
approved