The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A245578 The number of permutations of {0,0,1,1,...,n-1,n-1} that begin with 0 and in which adjacent elements are adjacent mod n. 3
1, 10, 18, 22, 32, 38, 50, 58, 72, 82, 98, 110, 128, 142, 162, 178, 200, 218, 242, 262, 288, 310, 338, 362, 392, 418, 450, 478, 512, 542, 578, 610, 648, 682, 722, 758, 800, 838, 882, 922, 968, 1010, 1058, 1102, 1152, 1198, 1250, 1298, 1352, 1402, 1458, 1510, 1568, 1622, 1682, 1738, 1800, 1858, 1922, 1982, 2048, 2110 (list; graph; refs; listen; history; text; internal format)
OFFSET
2,2
COMMENTS
a(n) is also the number of random walks of length 2n in which every residue class mod n occurs twice (except that there are 8 such walks when n=2).
LINKS
FORMULA
a(n) = 2 * A209350(n) if n>2. - Michael Somos, Jul 26 2014
G.f.: x^2 * (1+8*x-2*x^2-12*x^3+7*x^4) / ((1+x) * (1-x)^3). - Joerg Arndt, Jul 26 2014
a(n) = (3+5*(-1)^n+8*n+2*n^2)/4 if n>2. - Peter Luschny, Jul 26 2014
E.g.f.: (5*exp(-x)+exp(x)*(2*x*(x+5)+3)-(14*x^2+8*(x+1)))/4. - Peter Luschny, Aug 04 2014
EXAMPLE
a(3)=10 because of the solutions 012012,012021,012102,012120,010212, and their complements mod 3.
G.f. = x^2 + 10*x^3 + 18*x^4 + 22*x^5 + 32*x^6 + 38*x^7 + 50*x^8 + 58*x^9 + ...
MAPLE
A245578 := n -> `if`(n=2, 1, (3+5*(-1)^n+8*n+2*n^2)/4);
seq(A245578(n), n = 2..63); # Peter Luschny, Jul 26 2014
MATHEMATICA
CoefficientList[Series[(1 + 8 x - 2 x^2 - 12 x^3 + 7 x^4)/((1 + x) (1 - x)^3), {x, 0, 40}], x] (* Vincenzo Librandi, Aug 05 2014 *)
PROG
(PARI) Vec( x^2 * (1+8*x-2*x^2-12*x^3+7*x^4) / ((1+x) * (1-x)^3) + O(x^66) ) \\ Joerg Arndt, Jul 26 2014
(Magma) [1] cat [(3+5*(-1)^n+8*n+2*n^2)/4: n in [3..70]]; // Vincenzo Librandi, Aug 05 2014
CROSSREFS
Sequence in context: A055481 A213717 A333999 * A165250 A257512 A125689
KEYWORD
nonn,easy
AUTHOR
Don Knuth, Jul 25 2014
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 20 04:34 EDT 2024. Contains 372703 sequences. (Running on oeis4.)