OFFSET
1,2
COMMENTS
For each k from 1 to n, add k if k shares a common factor > 1 with n, otherwise add 1 (see example).
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..20000
FORMULA
a(p) = 2p-1 for primes p. - Wesley Ivan Hurt, Nov 28 2021
EXAMPLE
a(6) = 17 since we have 1 + 2 + 3 + 4 + 1 + 6 = 17 for k = 1..6 respectively.
MATHEMATICA
nterms=100; Join[{1}, Table[n(n+1)/2-(n-2)EulerPhi[n]/2, {n, 2, nterms}]] (* Paolo Xausa, Nov 26 2021 *)
PROG
(PARI) a(n) = if (n==1, 1, n*(n+1)/2 - (n-2)*eulerphi(n)/2); \\ Michel Marcus, Nov 25 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Wesley Ivan Hurt, Nov 24 2021
STATUS
approved