%I #16 Oct 10 2019 11:25:04
%S 1,2,4,5,7,16,11,19,24,26,19,45,23,40,47,51,31,74,34,75,70,64,43,111,
%T 62,77,89,111,56,150,58,116,110,97,115,185,68,110,136,173,80,212,83,
%U 166,209,132,91,258,134,187,173,202,103,278,182,257,200,168,116,383,120,177
%N a(1)=1; for n>1, a(n) = Sum_{k|n} (number of earlier terms which are coprime to k).
%H Robert Israel, <a href="/A127791/b127791.txt">Table of n, a(n) for n = 1..10000</a>
%e Since the positive divisors of 10 are 1,2,5,10, a(10) = (the number of earlier terms coprime to 1, which is 9) + (the number of earlier terms coprime to 2, which is 5 for a(1)=1, a(4)=5, a(5)=7, a(7)=11 and a(8)=19) + (the number of earlier terms coprime to 5, which is 8 for every earlier term except a(4)=5) + (the number of earlier terms coprime to 10, which is 4) = 9 + 5 + 8 + 4 = 26.
%p A127791[1]:= 1:
%p S[1]:= {}:
%p for n from 2 to 1000 do
%p F:= ifactors(n)[2];
%p t:= 0;
%p for i from 1 to n-1 do
%p Fi:= remove(t -> member(t[1],S[i]),F);
%p t:= t + mul(f[2]+1,f=Fi);
%p od;
%p A127791[n]:= t;
%p S[n]:= numtheory[factorset](t);
%p od:
%p seq(A127791[n],n=1..1000); # _Robert Israel_, May 06 2014
%t f[l_List] := Block[{n = Length[l] + 1, d = Divisors[n], c = 0},Do[ c += Length[Select[l, GCD[ #, d[[i]]] == 1 &]];, {i, Length[d]}];Append[l, c]];Nest[f, {1}, 64] (* _Ray Chandler_, Feb 08 2007 *)
%Y Cf. A127792.
%K nonn,look
%O 1,2
%A _Leroy Quet_, Jan 29 2007
%E Extended by _Ray Chandler_, Feb 08 2007