login
A215573
a(n) = n*(n+1)*(2n+1)/6 modulo n.
4
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,3
COMMENTS
a(n) = 0 for n = 6k +- 1, that is, A007310 (numbers congruent to 1 or 5 mod 6).
Graph consists of 4 linear patterns.
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
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Zak Seidov, Aug 16 2012
STATUS
approved