login
a(n) = Sum_{k=1..n} k^(n/gcd(k,n) - 1).
2

%I #11 Mar 10 2021 12:28:56

%S 1,2,6,31,355,3150,67172,904085,22998481,427799450,14914341926,

%T 287337926355,13421957361111,339940911160914,15434209582905140,

%U 493467700905592777,28101527071305611529,836396358233559195382

%N a(n) = Sum_{k=1..n} k^(n/gcd(k,n) - 1).

%F If p is prime, a(p) = A031971(p-1) + 1.

%t a[n_] := Sum[k^(n/GCD[k, n] - 1), {k, 1, n}]; Array[a, 18] (* _Amiram Eldar_, Mar 10 2021 *)

%o (PARI) a(n) = sum(k=1, n, k^(n/gcd(k, n)-1));

%Y Cf. A031971, A332621, A342394, A342395.

%K nonn,easy

%O 1,2

%A _Seiichi Manyama_, Mar 10 2021