OFFSET
1,4
COMMENTS
Sum of differences j-i for 0 < i < j coprime to n with i+j = n.
If p is an odd prime, a(p^k) = (p-1)*(p^(2*k-1)-1)/4.
Primes in this sequence are a(4) = 2 and a(3^k) = (3^(2*k-1)-1)/2 where 2*k-1 is in A028491.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = Sum_{k=1..floor((n-1)/2)} floor(1/gcd(n,n-k)) * (n-2*k). - Wesley Ivan Hurt, Jan 18 2021
EXAMPLE
For n = 10, a(10) = (10-2*1) + (10-2*3) = 12.
MAPLE
f:= proc(n) local j; add(n-2*j, j= select(t -> igcd(t, n)=1, [$1..(n-1)/2])) end proc:
map(f, [$1..100]);
MATHEMATICA
Table[Sum[(n - 2 i) Floor[1/GCD[n - i, n]], {i, Floor[(n-1)/2]}], {n, 80}] (* Wesley Ivan Hurt, Jan 18 2021 *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
J. M. Bergot and Robert Israel, Jan 17 2021
STATUS
approved