login
A346972
a(1)=1, a(2)=4, a(n) = (n*a(n-1) - (n-1)*a(n-2)) mod (n+1).
0
1, 4, 2, 1, 3, 6, 0, 3, 7, 10, 4, 3, 5, 1, 9, 10, 8, 12, 4, 20, 10, 7, 13, 1, 25, 4, 18, 19, 17, 21, 13, 29, 31, 27, 35, 19, 13, 25, 1, 8, 36, 23, 5, 41, 15, 20, 10, 30, 40, 20, 8, 32, 38, 26, 50, 2, 40, 23, 57, 50, 2, 35, 33, 37, 29, 45, 13, 8, 18, 69, 39, 26
OFFSET
1,2
COMMENTS
Goes as high as 2917 before settling to a final value of 77 for all n >= 2982.
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
Sequence in context: A337063 A375119 A010311 * A326485 A023528 A236308
KEYWORD
nonn,easy
AUTHOR
Steven M. Altschuld, Aug 09 2021
STATUS
approved