A215573 a(n) = n*(n+1)*(2n+1)/6 modulo n.
0, 1, 2, 2, 0, 1, 0, 4, 6, 5, 0, 2, 0, 7, 10, 8, 0, 3, 0, 10, 14, 11, 0, 4, 0, 13, 18, 14, 0, 5, 0, 16, 22, 17, 0, 6, 0, 19, 26, 20, 0, 7, 0, 22, 30, 23, 0, 8, 0, 25, 34, 26, 0, 9, 0, 28, 38, 29, 0, 10, 0, 31, 42, 32, 0, 11, 0, 34, 46, 35, 0, 12, 0, 37, 50, 38
Offset: 1
Links
- Zak Seidov, Table of n, a(n) for n = 1..1000
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,0,2,0,0,0,0,0,-1).
Programs
-
Maple
seq(modp(n*(n+1)*(2*n+1)/6,n),n=1..100); # Muniru A Asiru, Feb 07 2019
-
Mathematica
Table[Mod[(n(n+1)(2n+1))/6,n],{n,80}] (* or *) LinearRecurrence[{0,0,0,0,0,2,0,0,0,0,0,-1},{0,1,2,2,0,1,0,4,6,5,0,2},80] (* Harvey P. Dale, Aug 25 2023 *)
-
PARI
a(n)=n*(n+1)*(2*n+1)/6 % n; \\ Michel Marcus, Oct 19 2013
-
PARI
concat(0, Vec(x^2*(1 + 2*x + 2*x^2 + x^4 + 2*x^6 + 2*x^7 + x^8) / ((1 - x)^2*(1 + x)^2*(1 - x + x^2)^2*(1 + x + x^2)^2) + O(x^80))) \\ Colin Barker, Feb 07 2019
-
Python
def A215573(n): return n*(n-1)*((n<<1)-1)//6%n # Chai Wah Wu, Jun 03 2024
Formula
a(n) = A000330(n) mod n.
From Colin Barker, Feb 07 2019: (Start)
G.f.: x^2*(1 + 2*x + 2*x^2 + x^4 + 2*x^6 + 2*x^7 + x^8) / ((1 - x)^2*(1 + x)^2*(1 - x + x^2)^2*(1 + x + x^2)^2).
a(n) = 2*a(n-6) - a(n-12) for n>12. (End)
a(6*n) = n, a(6*n+1) = 0, a(6*n+2) = 3*n+1, a(6*n+3) = 4*n+2, a(6*n+4) = 3*n+2, a(6*n+5) = 0. - Philippe Deléham, Mar 05 2023
a(n) = A048153(n) mod n. - Alois P. Heinz, Jun 03 2024
a(n) = A000330(n-1) mod n. - Chai Wah Wu, Jun 03 2024
Sum_{k=1..n} a(k) ~ (11/72) * n^2. - Amiram Eldar, Apr 05 2025
Comments