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!)
A192447 a(n) = n*(n-1)/2 if this is even, otherwise (n*(n-1)/2) + 1. 2

%I #30 Oct 26 2020 16:05:36

%S 0,2,4,6,10,16,22,28,36,46,56,66,78,92,106,120,136,154,172,190,210,

%T 232,254,276,300,326,352,378,406,436,466,496,528,562,596,630,666,704,

%U 742,780,820,862,904,946,990,1036,1082,1128,1176,1226,1276,1326,1378,1432

%N a(n) = n*(n-1)/2 if this is even, otherwise (n*(n-1)/2) + 1.

%C 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).

%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (3,-4,4,-3,1).

%F a(n) = n*(n-1)/2 if this is even and a(n) = (n*(n-1)/2) + 1 otherwise.

%F a(n) = 2*A054925(n+1).

%F G.f.: 2*x*(x^2 - x + 1)/((1 - x)^3*(1 + x^2)).

%F a(n) = (n^2 - n + 1 - (-1)^(n*(n-1)/2))/2. - _Guenther Schrack_, Jun 04 2019

%e 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.

%t Table[(n^2 - n + 1 - (-1)^(n (n - 1)/2))/2, {n, 1, 60}] (* _Bruno Berselli_, Jun 07 2019 *)

%t LinearRecurrence[{3,-4,4,-3,1}, {0,2,4,6,10}, 54] (* _Georg Fischer_, Oct 26 2020 *)

%o (PARI) a(n) = my(m=n*(n-1)/2); if (m % 2, m+1, m); \\ _Michel Marcus_, Jun 07 2019

%Y Equals the corresponding term of A000217 if it is even or is 1 more otherwise.

%Y Cf. A054925.

%K nonn,easy

%O 1,2

%A _Ivaylo Kortezov_, Jul 01 2011

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 June 10 16:56 EDT 2024. Contains 373277 sequences. (Running on oeis4.)