[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A118002
a(0) = 0. a(n) = a(n-1) + (largest integer <= n which is coprime to a(n-1)).
3
0, 1, 3, 5, 9, 14, 19, 26, 33, 41, 51, 62, 73, 86, 99, 113, 129, 146, 163, 182, 201, 221, 243, 266, 289, 314, 339, 365, 393, 422, 451, 482, 513, 545, 579, 614, 649, 686, 723, 761, 801, 842, 883, 926, 969, 1013, 1059, 1106, 1153, 1202, 1251, 1301, 1353, 1406
OFFSET
0,3
LINKS
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
Sequence in context: A082874 A266250 A127720 * A069533 A054066 A081946
KEYWORD
nonn
AUTHOR
Leroy Quet, Apr 09 2006
EXTENSIONS
More terms from R. J. Mathar, Jun 06 2007
STATUS
approved