OFFSET
1,2
COMMENTS
Goes as high as 2917 before settling to a final value of 77 for all n >= 2982.
LINKS
FORMULA
a(n) = 77 for n >= 2982.
MATHEMATICA
a[1] = 1; a[2] = 4; a[n_] := a[n] = Mod[n*a[n - 1] - (n - 1)*a[n - 2], n + 1]; Array[a, 100] (* Amiram Eldar, Aug 10 2021 *)
nxt[{n_, a_, b_}]:={n+1, b, Mod[b(n+1)-n*a, n+2]}; NestList[nxt, {2, 1, 4}, 80][[;; , 2]] (* Harvey P. Dale, Oct 15 2023 *)
PROG
(PARI) lista(nn) = {my(va = vector(nn)); va[1] = 1; va[2] = 4; for (n=3, nn, va[n] = (n*va[n-1] - (n-1)*va[n-2]) % (n+1); ); va; } \\ Michel Marcus, Aug 10 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Steven M. Altschuld, Aug 09 2021
STATUS
approved