login
A095234
a(1) = 1, a(n) = n+a(n-1) if n does not divide a(n-1), else a(n) = n*a(n-1).
2
1, 3, 9, 13, 18, 108, 115, 123, 132, 142, 153, 165, 178, 192, 207, 223, 240, 258, 277, 297, 318, 340, 363, 387, 412, 438, 465, 493, 14297, 14327, 14358, 14390, 14423, 14457, 14492, 14528, 14565, 14603, 14642, 14682, 14723, 14765, 14808, 14852
OFFSET
1,2
COMMENTS
Where a(n) <> a(n-1)+n: 3, 6, 29, 116 and 348 and no others < 2*10^6. - Robert G. Wilson v, Jun 18 2004
LINKS
EXAMPLE
a(29) = a(28)*29 = 493*29 = 14297 since 29 divides a(28) = 493 = 17*29.
MATHEMATICA
a[1] = 1; a[n_] := a[n] = If[Mod[a[n - 1], n] == 0, n*a[n - 1], a[n - 1] + n]
nxt[{n_, a_}]:={n+1, If[Divisible[a, n+1], a(n+1), a+n+1]}; NestList[nxt, {1, 1}, 50][[All, 2]] (* Harvey P. Dale, Jan 14 2017 *)
PROG
(PARI) m=44; print1(a=1, ", "); for(n=2, m, print1(a=if(a%n>0, n+a, n*a), ", ")) \\ Klaus Brockhaus, Jun 18 2004
CROSSREFS
Cf. A096155 for those n that divide a(n-1).
Sequence in context: A088090 A075326 A298870 * A240240 A032415 A268044
KEYWORD
easy,nonn
AUTHOR
Amarnath Murthy, Jun 13 2004
EXTENSIONS
Edited and extended by Johan Claes, Klaus Brockhaus and Robert G. Wilson v, Jun 18 2004
STATUS
approved