login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A203648 a(n) = (1/4) * period of repeating sequence {S(j) mod 2n}, where S(j) is the sum of the first j squares. 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=1..n} k^(2*j)) mod 2*n will produce the same sequence. The periods appear to always end in 2 zeros.

(Sum_{k=1..n} k^j) 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 entries for 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)).

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) = 2*n + 2*n*((-1)^(-2*n/3) + (-1)^(2*n/3)-1/2)/3.

a(n) = -a(-n) = 2*a(n-3) - a(n-6). (End)

a(n) = numerator(3n/((3 + 2*(-1 + n))*(1 + n))). - Andres Cicuttin, Jan 12 2017

a(n) is multiplicative with a(p^e) = p^(e+1) if p = 3, a(p^e) = p^e otherwise. - Michael Somos, Jan 18 2017

a(n) = n*(5 + 4*cos((2*Pi*n)/3)) / 3. - Colin Barker, Mar 06 2017

EXAMPLE

G.f. = x + 2*x^2 + 9*x^3 + 4*x^4 + 5*x^5 + 18*x^6 + 7*x^7 + 8*x^8 + 27*x^9 + ...

(Sum_{k=1..n} k^2) 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 *)

Table[n (1 + 2 Floor[Mod[n + 2, 3]/2]), {n, 57}] (* Michael De Vlieger, Jan 14 2017 *)

PROG

(MAGMA) [n*(1+2*Floor(((n+2) mod 3)/2)): n in [1..60]]; // Vincenzo Librandi, Mar 19 2012

(PARI) {a(n) = if( n%3, n, 3*n)}; /* Michael Somos, Jan 18 2017 */

CROSSREFS

Sequence in context: A248682 A222239 A281384 * A300889 A275807 A202324

Adjacent sequences:  A203645 A203646 A203647 * A203649 A203650 A203651

KEYWORD

nonn,easy,mult

AUTHOR

Gary Detlefs, Jan 04 2012

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 22 02:13 EST 2019. Contains 320381 sequences. (Running on oeis4.)