%I #32 Oct 10 2023 16:24:51
%S 0,2,3,4,5,7,7,8,9,13,11,14,13,19,22,16,17,21,19,26,32,31,23,28,25,37,
%T 27,38,29,38,31,32,52,49,58,42,37,55,62,52,41,56,43,62,66,67,47,56,49,
%U 65,82,74,53,63,94,76,92,85,59,76,61,91,96,64,112,92,67,98,112,106,71
%N a(n) is the sum of primes p for those k's, 2 <= k <= n, where gcd(k,n) = p^j > 1. (a(1) = 0.)
%H Antti Karttunen, <a href="/A122411/b122411.txt">Table of n, a(n) for n = 1..65537</a>
%F a(n) = phi(n) * Sum_{p|n} p/(p-1), where p is prime. - _Ridouane Oudra_, Feb 03 2023
%F a(n) = Sum_{d|n, d is a prime power} A020639(d)*phi(n/d). - _Ridouane Oudra_, Feb 13 2023
%F a(n) = Sum_{p|n, p prime} p^v(n,p)*phi(n/p^v(n,p)), where p^v(n,p) is the highest power of p dividing n. - _Ridouane Oudra_, Oct 06 2023
%e The integers k, 2 <= k <= 12, where gcd(k,12) is a power of a prime are 2,3,4,8,9 and 10. gcd(2,12) = 2^1, gcd(3,12) = 3^1, gcd(4,12) = 2^2, gcd(8, 12) = 2^2, gcd(9,12) = 3^1 and gcd(10,12) = 2^1. The sum of the prime bases of the prime-powers is 2+3+2+2+3+2 = 14. So a(12) = 14.
%p with(numtheory): a:= proc(n) local k, m := 0; for k from 2 to n do if nops(factorset(gcd(n, k))) = 1 then m:= m + factorset(gcd(n, k))[1]; end if; end do; return m; end proc: seq(a(n), n=1..80); # _Ridouane Oudra_, Feb 03 2023
%t f[n_] := Plus @@ First /@ Flatten[Select[FactorInteger[GCD[Range[n], n]], Length[ # ] == 1 &], 1]; Table[f[n], {n, 80}] (* _Ray Chandler_, Sep 06 2006 *)
%o (PARI) A122411(n) = { my(p=0); sum(k=2,n,if(isprimepower(gcd(n,k),&p),p,0)); }; \\ _Antti Karttunen_, Feb 25 2018
%Y Cf. A122410.
%K nonn
%O 1,2
%A _Leroy Quet_, Sep 02 2006
%E Corrected and extended by _Ray Chandler_, Sep 06 2006