login
Let gcd_2(b,c) be the second-largest common divisor of non-coprime integers b and c; then a(n) = Sum_{k=1..n} gcd_2(k,n). If b and c are coprime, then gcd_2(b,c) = 0.
2

%I #16 Dec 28 2019 17:02:37

%S 0,1,1,3,1,6,1,8,5,10,1,17,1,14,11,20,1,26,1,29,15,22,1,44,9,26,21,41,

%T 1,56,1,48,23,34,17,73,1,38,27,76,1,80,1,65,51,46,1,108,13,74,35,77,1,

%U 102,25,108,39,58,1,157,1

%N Let gcd_2(b,c) be the second-largest common divisor of non-coprime integers b and c; then a(n) = Sum_{k=1..n} gcd_2(k,n). If b and c are coprime, then gcd_2(b,c) = 0.

%C The first even solution of the equation a(n) = n which divided by 2 is not a prime number is 8. Is there a larger such number? If such a number exists, is greater than 5*10^4. If no such number exists, consecutive even solutions of the above equation are consecutive terms of A073582.

%H Antti Karttunen, <a href="/A309491/b309491.txt">Table of n, a(n) for n = 1..10080</a>

%H Antti Karttunen, <a href="/A309491/a309491.txt">Data supplement: n, a(n) computed for n = 1..65537</a>

%e a(4) = gcd_2(1,4) + gcd_2(2,4) + gcd_2(3,4) + gcd_2(4,4) = 0 + 1 + 0 + 2 = 3.

%t r[n_] := If[n==1, 0, n/FactorInteger[n][[1, 1]]]; a[n_] := Sum[r[GCD[n, k]], {k, 1, n}]; Array[a, 70] (* _Amiram Eldar_, Aug 06 2019 *)

%o (PARI)

%o A032742with_a1_0(n) = if(1==n,0,n/vecmin(factor(n)[,1]));

%o gcd_2(a,b) = A032742with_a1_0(gcd(a,b));

%o A309491(n) = sum(k=1,n,gcd_2(k,n)); \\ _Antti Karttunen_, Dec 28 2019

%Y Cf. A018804, A073582.

%K nonn

%O 1,4

%A _Lechoslaw Ratajczak_, Aug 04 2019

%E Definition clarified by _Antti Karttunen_, Dec 28 2019