Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #16 Jan 21 2019 15:35:40
%S 0,1,3,5,9,14,19,26,33,41,51,62,73,86,99,113,129,146,163,182,201,221,
%T 243,266,289,314,339,365,393,422,451,482,513,545,579,614,649,686,723,
%U 761,801,842,883,926,969,1013,1059,1106,1153,1202,1251,1301,1353,1406
%N a(0) = 0. a(n) = a(n-1) + (largest integer <= n which is coprime to a(n-1)).
%H Michael De Vlieger, <a href="/A118002/b118002.txt">Table of n, a(n) for n = 0..10000</a>
%e a(7) = 26. 8 is not coprime to 26. The smallest integer <= 8 which is coprime to 26 is 7 and so a(8) = a(7) + 7 = 33.
%p A118002 := proc(nmax) local a,n ; a := [0] ; while nops(a) < nmax do n := nops(a) ; while gcd(n,op(-1,a)) <> 1 do n := n-1 ; od ; a := [op(a), op(-1,a)+n] ; od ; RETURN(a) ; end: A118002(100) ; # _R. J. Mathar_, Jun 06 2007
%t FoldList[Block[{k = 0}, While[! CoprimeQ[#1, #2 - k], k++]; #1 + #2 - k] &, 0, Range@ 53] (* _Michael De Vlieger_, Sep 30 2017 *)
%t nxt[{n_,a_}]:={n+1,a+SelectFirst[Range[n,1,-1],CoprimeQ[#,a]&]}; Join[ {0,1}, NestList[nxt,{3,3},60][[All,2]]] (* _Harvey P. Dale_, Jan 21 2019 *)
%Y Cf. A118000, A118003.
%K nonn
%O 0,3
%A _Leroy Quet_, Apr 09 2006
%E More terms from _R. J. Mathar_, Jun 06 2007