This site is supported by donations to The OEIS Foundation. Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A192447 a(n) = n*(n-1)/2 if this is even, otherwise (n*(n-1)/2) + 1. 1
 0, 2, 4, 6, 10, 16, 22, 28, 36, 46, 56, 66, 78, 92, 106, 120, 136, 154, 172, 190, 210, 232, 254, 276, 300, 326, 352, 378, 406, 436, 466, 496, 528, 562, 596, 630, 666, 704, 742, 780, 820, 862, 904, 946, 990, 1036, 1082, 1128, 1176, 1226, 1276, 1326, 1378, 1432 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,2 COMMENTS Least number of swaps of passports of n persons so that each two have swapped at least once and finally each one gets his own passport (JBMO 2011 Shortlist). LINKS Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1). FORMULA a(n) = n*(n-1)/2 if this is even and a(n) = (n*(n-1)/2) + 1 otherwise. a(n) = 2*A054925(n+1). G.f.: 2*x*(x^2 - x + 1)/((1 - x)^3*(1 + x^2)). a(n) = (n^2 - n + 1 - (-1)^(n*(n-1)/2))/2. - Guenther Schrack, Jun 04 2019 EXAMPLE a(3)=4: Let the initial state be Aa, Bb, Cc. Swap(AB) to get Ab, Ba, Cc. Swap(AC) to get Ac, Ba, Cb. Swap(BC) to get Ac, Bb, Ca. Swap(AC) to get Aa, Bb, Cc, done. MATHEMATICA Table[(n^2 - n + 1 - (-1)^(n (n - 1)/2))/2, {n, 1, 60}] (* Bruno Berselli, Jun 07 2019 *) PROG (PARI) a(n) = my(m=n*(n-1)/2); if (m % 2, m+1, m); \\ Michel Marcus, Jun 07 2019 CROSSREFS Equals the corresponding term of A000217 if it is even or is 1 more otherwise. Cf. A054925. Sequence in context: A130320 A258599 A101176 * A131882 A073150 A076529 Adjacent sequences:  A192444 A192445 A192446 * A192448 A192449 A192450 KEYWORD nonn,easy AUTHOR Ivaylo Kortezov, Jul 01 2011 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.

Last modified September 21 00:17 EDT 2019. Contains 327252 sequences. (Running on oeis4.)