OFFSET
0,3
LINKS
Michael De Vlieger, Table of n, a(n) for n = 0..10000
EXAMPLE
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.
MAPLE
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
MATHEMATICA
FoldList[Block[{k = 0}, While[! CoprimeQ[#1, #2 - k], k++]; #1 + #2 - k] &, 0, Range@ 53] (* Michael De Vlieger, Sep 30 2017 *)
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 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Apr 09 2006
EXTENSIONS
More terms from R. J. Mathar, Jun 06 2007
STATUS
approved