A179054 a(n) = (1^k + 2^k + ... + n^k) modulo (n+2), where k is any odd integer greater than or equal to 3.
1, 1, 1, 4, 1, 1, 1, 6, 1, 1, 1, 8, 1, 1, 1, 10, 1, 1, 1, 12, 1, 1, 1, 14, 1, 1, 1, 16, 1, 1, 1, 18, 1, 1, 1, 20, 1, 1, 1, 22, 1, 1, 1, 24, 1, 1, 1, 26, 1, 1, 1, 28, 1, 1, 1, 30, 1, 1, 1, 32, 1, 1, 1, 34, 1, 1, 1, 36, 1, 1, 1, 38, 1, 1, 1, 40, 1, 1, 1, 42, 1, 1, 1, 44, 1, 1, 1, 46, 1, 1, 1, 48, 1, 1, 1
Offset: 1
Examples
a(4) = (1^3 + 2^3 + 3^3 + 4^3) mod 6 = 100 mod 6 = 4.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,2,0,0,0,-1).
Programs
-
Magma
&cat [[1,1,1,2*n]: n in [1..30]]; // Vincenzo Librandi, Dec 05 2016
-
Maple
seq(op([1,1,1,2*k]),k=2..50); # Robert Israel, Dec 05 2016
-
Mathematica
f[n_] := Mod[n^2(n + 1)^2/4, n + 2]; Array[f, 100] (* Robert G. Wilson v, Jul 01 2010 *) LinearRecurrence[{0, 0, 0, 2, 0, 0, 0, -1}, {1, 1, 1, 4, 1, 1, 1, 6}, 100] (* Vincenzo Librandi, Dec 05 2016 *)
-
PARI
s=0; for(n=1, 100, s+=n^3; print(s%(n+2)))
Formula
a(n) = 2m+2, if n = 4m for some integer m; a(n) = 1 otherwise.
G.f.: (x+x^2+x^3+4*x^4-x^5-x^6-x^7-2*x^8)/(1-2*x^4+x^8). - Robert Israel, Dec 05 2016
Extensions
Typo in name of sequence corrected and formula added by Nick Hobson, Jun 27 2010
More terms from Robert G. Wilson v, Jul 01 2010