%I #20 Nov 19 2020 07:54:12
%S 1,1,2,4,9,20,47,110,260,614,1448,3421,8081,19092,45107,106567,251768,
%T 594816,1405285,3320066,7843851,18531547,43781846,103437135,244376187,
%U 577352823,1364029309,3222597827,7613573030,17987504932,42496516727,100400469160
%N a(1) = 1; a(n+1) = Sum_{k=1..n} (a(k)-th integer from among those positive integers which are coprime to (n+1-k)).
%H Alois P. Heinz, <a href="/A130802/b130802.txt">Table of n, a(n) for n = 1..800</a>
%e The integers coprime to 5 are 1, 2, 3, 4, 6, ... The a(1)-th=1st of these is 1. The integers coprime to 4 are 1, 3, 5, ... The a(2)-th=1st of these is 1. The integers coprime to 3 are 1, 2, 4, 5, ... The a(3)-th=2nd of these is 2. The integers coprime to 2 are 1, 3, 5, 7, 9, ... The a(4)-th=4th of these is 7. And the integers coprime to 1 are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ... The a(5)-th=9th of these is 9. So a(6) = 1 + 1 + 2 + 7 + 9 = 20.
%p with(numtheory): fc:= proc(t,p) option remember; local m, j, h, pp; if p=1 then t else pp:= phi(p); m:= iquo(t,pp); j:= m*pp; h:= m*p-1; while j<t do h:= h+1; if igcd(p,h)=1 then j:= j+1 fi od; h fi end: a:= proc(n) option remember; `if`(n=1, 1, add(fc(a(k), (n-k)), k=1..n-1)) end: seq(a(n), n=1..35); # _Alois P. Heinz_, Aug 05 2009
%t fc[t_, p_] := fc[t, p] = Module[{m, j, h, pp}, If[p == 1, t, pp = EulerPhi[p]; m = Quotient[t, pp]; j = m pp; h = m p - 1; While[j < t, h++; If[GCD[p, h] == 1, j++]]; h]];
%t a[n_] := a[n] = If [n == 1, 1, Sum[fc[a[k], (n - k)], {k, 1, n - 1}]];
%t Array[a, 35] (* _Jean-François Alcover_, Nov 19 2020, after _Alois P. Heinz_ *)
%Y Cf. A132273, A132274, A132275.
%K nonn
%O 1,3
%A _Leroy Quet_, Aug 20 2007
%E More terms from _Alois P. Heinz_, Aug 05 2009