%I #13 Oct 27 2019 05:10:04
%S 1,2,3,2,5,-1,7,5,7,-3,11,-3,13,5,7,9,17,-15,19,7,11,3,23,-15,9,17,33,
%T -3,29,-55,31,77,47,-15,45,-89,37,91,79,-45,41,-171,43,183,189,37,47,
%U -351,155,123,373,165,53,-655,-471,533,553,191,59,-859,61,861,233,33,839,-1073,67,687,1761,-637,71
%N For all n >= 2, Sum_{2<=k<=n, gcd(k,n)>1} a(k) = n. a(1)=1.
%e The positive integers which are <= 12 and are not coprime to 12 are 2,3,4,6,8,9,10,12. And a(12) is such that a(2)+a(3)+a(4)+a(6)+a(8)+a(9)+a(10)+a(12) = 12.
%t f[n_] := Select[Range[2, n], GCD[ #, n] > 1 &]; g[l_] := Block[{n = Length[l] + 1},Append[l, n - Plus @@ l[[Most[f[n]]]]]];Nest[g, {1}, 70] (* _Ray Chandler_, Nov 13 2006 *)
%Y Cf. A124385.
%K sign
%O 1,2
%A _Leroy Quet_, Oct 29 2006
%E Extended by _Ray Chandler_, Nov 13 2006