A330715 a(1), a(2), a(3) = 1; a(n) = (a(n-1) mod a(n-3)) + a(n-2) + 1.
1, 1, 1, 2, 2, 3, 4, 4, 6, 7, 10, 12, 16, 19, 24, 28, 34, 39, 46, 52, 60, 67, 76, 84, 94, 103, 114, 124, 136, 147, 160, 172, 186, 199, 214, 228, 244, 259, 276, 292, 310, 327, 346, 364, 384, 403, 424, 444, 466, 487, 510, 532, 556, 579, 604, 628, 654, 679, 706, 732
Offset: 1
Links
- Matthew Niemiro, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
Nest[Append[#, Mod[#[[-1]], #[[-3]] ] + #[[-2]] + 1] &, {1, 1, 1}, 57] (* Michael De Vlieger, Dec 27 2019 *) nxt[{a_,b_,c_}]:={b,c,Mod[c,a]+b+1}; NestList[nxt,{1,1,1},60][[;;,1]] (* Harvey P. Dale, Jul 18 2025 *)
-
Python
x = 1 y = 1 z = 1 for i in range(4, 1001): new = z % x + y + 1 print(str(i) +" " + str(new)) x = y y = z z = new
Formula
a(1), a(2), a(3) = 1; a(n) = (a(n-1) mod a(n-3)) + a(n-2) + 1.
Conjectures from Colin Barker, Dec 28 2019: (Start)
G.f.: x*(1 - x - x^2 + 2*x^3 - x^4 + x^6 - 2*x^7 + 2*x^8) / ((1 - x)^3*(1 + x)).
a(n) = 2*a(n-1) - 2*a(n-3) + a(n-4) for n>9.
a(n) = (99 - 3*(-1)^n - 24*n + 2*n^2) / 8 for n>5.
(End)
Extensions
More terms from Michael De Vlieger, Dec 27 2019