|
| |
|
|
A203648
|
|
Period length of sum(k^2, k=1..n) mod 2n, divided by 4.
|
|
1
|
|
|
|
1, 2, 9, 4, 5, 18, 7, 8, 27, 10, 11, 36, 13, 14, 45, 16, 17, 54, 19, 20, 63, 22, 23, 72, 25, 26, 81, 28, 29, 90, 31, 32, 99, 34, 35, 108, 37, 38, 117, 40, 41, 126, 43, 44, 135, 46, 47, 144, 49, 50, 153, 52, 53, 162, 55, 56, 171
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
|
OFFSET
|
1,2
|
|
|
COMMENTS
|
This sequence lists the period lengths of the sum of the first n squares mod 2*n. In most cases, sum(k^(2*j), k=1..n) mod 2*n will produce the same sequence. The periods appear to always end in 2 zeros.
The sum(k^j, k=1..n) mod 2 has period 4 repeating [1,1,0,0] for any j.
|
|
|
LINKS
|
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Index to sequences with linear recurrences with constant coefficients, signature (0,0,2,0,0,-1).
|
|
|
FORMULA
|
a(n) = 3*n if n mod 3 = 0, else n.
a(n) = n*(1+2*floor(((n+2) mod 3)/2))).
Contribution from Bruno Berselli, Jan 04 2012: (Start)
G.f.: x*(1+2*x+9*x^2+2*x^3+x^4))/((1-x)^2*(1+x+x^2)^2).
a(n) = 2n + 2n((-1)^(-2n/3)+(-1)^(2n/3)-1/2)/3.
a(n) = -a(-n) = 2*a(n-3)-a(n-6). (End)
|
|
|
EXAMPLE
|
sum(k^2,k=1..n) mod 4 has period 8 repeating [1,1,2,2,3,3,0,0] so a(2)= 2
|
|
|
MAPLE
|
seq(n*(1+floor(((n+2) mod 3)/2))), n= 1..57);
|
|
|
MATHEMATICA
|
CoefficientList[Series[(1+2*x+9*x^2+2*x^3+x^4)/((1-x)^2*(1+x+x^2)^2), {x, 0, 60}], x] (* Vincenzo Librandi, Mar 19 2012 *)
|
|
|
PROG
|
(MAGMA) [n*(1+2*Floor(((n+2) mod 3)/2)): n in [1..60]]; // Vincenzo Librandi, Mar 19 2012
|
|
|
CROSSREFS
|
Sequence in context: A016642 A070700 A222239 * A202324 A199267 A115290
Adjacent sequences: A203645 A203646 A203647 * A203649 A203650 A203651
|
|
|
KEYWORD
|
nonn,easy
|
|
|
AUTHOR
|
Gary Detlefs, Jan 04 2012
|
|
|
STATUS
|
approved
|
| |
|
|