A372865 a(n) = (Sum_{k = 1..n-1} k*a(k)) (mod n) with a(1) = 1.
1, 1, 0, 3, 0, 3, 5, 4, 1, 9, 1, 6, 9, 7, 2, 15, 2, 9, 13, 10, 3, 21, 3, 12, 17, 13, 4, 27, 4, 15, 21, 16, 5, 33, 5, 18, 25, 19, 6, 39, 6, 21, 29, 22, 7, 45, 7, 24, 33, 25, 8, 51, 8, 27, 37, 28, 9, 57, 9, 30, 41, 31, 10, 63, 10, 33, 45, 34, 11, 69, 11, 36, 49, 37, 12, 75, 12, 39, 53, 40
Offset: 1
Links
- MathOverflow, Mod sequences that seem to become constant
Programs
-
Maple
a := proc(n, s) option remember; if n = 1 then s else irem(add(k*a(k, s), k = 1 .. n-1), n) end if; end proc: seq(a(n, 1), n = 1..80);
-
Mathematica
CoefficientList[Series[x(x^8 + 4*x^7 + 4*x^6 + 2*x^5 + x^4 + 2*x^3 + x^2 + 2*x + 1)/((x + 1)^2*(x - 1)^2*(x^2 - x + 1)*(x^2 + x + 1)^2),{x,0,80}],x] (* Stefano Spezia, May 18 2024 *)
-
PARI
lista(nn) = my(v=vector(nn)); v[1]=1; for(n=2, nn, v[n]=sum(k=1, n-1, k*v[k])%n); v; \\ Michel Marcus, May 18 2024
Formula
a(n) is quasipolynomial in n (proved by induction): a(6*n) = 3*n for n >= 1, and for n >= 0, a(6*n+1) = 4*n + 1, a(6*n+2) = 3*n + 1, a(6*n+3) = n, a(6*n+4) = 6*n + 3 and a(6*n+5) = n.
G.f.: A(x) = x*(x^8 + 4*x^7 + 4*x^6 + 2*x^5 + x^4 + 2*x^3 + x^2 + 2*x + 1)/((x + 1)^2*(x - 1)^2*(x^2 - x + 1)*(x^2 + x + 1)^2).
Comments