%I #46 Jan 20 2021 05:55:40
%S 0,2,12,28,100,90,392,408,792,810,2420,1356,4732,3346,4560,6320,13872,
%T 7506,21660,12140,18900,21802,46552,22008,53000,43290,61668,49980,
%U 117740,48450,153760,100192,123552,129506,169260,111420,312132,203642,245544,195640
%N a(n) = Sum_{k=1..n-1} lcm(lcm(n, k), lcm(n, n-k)).
%H Sebastian Karlsson, <a href="/A338798/b338798.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Lc#lcm">Index entries for sequences related to lcm's</a>
%F a(n) = n*Sum_{k=1..n-1} k*(n-k)/gcd(n,k)^2.
%F a(n) = (1/6)*n*Sum_{d|n} d*(d*phi(d) - A023900(d)).
%F a(p^e) = (1/6)*p^(e+1)*(p^e-1)*(p^(e+1) + p^(2*e+1) + p^2 + 2*p + 1)/(p^2 + p + 1).
%F a(prime(n)) = A138421(n). - _Michel Marcus_, Jan 20 2021
%t a[n_] := Sum[LCM[LCM[n, k], LCM[n, n - k]], {k, 1, n - 1}];
%t Table[a[n], {n, 1, 40}] (* _Robert P. P. McKone_, Jan 18 2021 *)
%o (Python)
%o from math import gcd
%o for n in range(1, 41):
%o print(n*sum([k*(n-k)//(gcd(n,k)**2) for k in range(1, n)]), end=', ')
%o (PARI) a(n) = sum(k=1, n-1, lcm(lcm(n, k), lcm(n, n-k))); \\ _Michel Marcus_, Jan 18 2021
%Y Cf. A000010, A006580, A023900, A051193, A057661, A138421.
%K nonn
%O 1,2
%A _Sebastian Karlsson_, Jan 18 2021