%I #15 Feb 11 2024 11:44:51
%S 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,
%T 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,
%U 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
%N a(n) = (1^k + 2^k + ... + n^k) modulo (n+2), where k is any odd integer greater than or equal to 3.
%H Robert Israel, <a href="/A179054/b179054.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Rec#order_08">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,2,0,0,0,-1).
%F a(n) = 2m+2, if n = 4m for some integer m; a(n) = 1 otherwise.
%F 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
%e a(4) = (1^3 + 2^3 + 3^3 + 4^3) mod 6 = 100 mod 6 = 4.
%p seq(op([1,1,1,2*k]),k=2..50); # _Robert Israel_, Dec 05 2016
%t f[n_] := Mod[n^2(n + 1)^2/4, n + 2]; Array[f, 100] (* _Robert G. Wilson v_, Jul 01 2010 *)
%t LinearRecurrence[{0, 0, 0, 2, 0, 0, 0, -1}, {1, 1, 1, 4, 1, 1, 1, 6}, 100] (* _Vincenzo Librandi_, Dec 05 2016 *)
%o (PARI) s=0; for(n=1, 100, s+=n^3; print(s%(n+2)))
%o (Magma) &cat [[1,1,1,2*n]: n in [1..30]]; // _Vincenzo Librandi_, Dec 05 2016
%K easy,nonn
%O 1,4
%A _Nick Hobson_, Jun 27 2010
%E Typo in name of sequence corrected and formula added by _Nick Hobson_, Jun 27 2010
%E More terms from _Robert G. Wilson v_, Jul 01 2010
|