A078628
Number of ways of arranging the numbers 1..n in a circle so that there is no consecutive triple i, i+1, i+2 or i, i-1, i-2 (mod n).
Original entry on oeis.org
1, 1, 0, 4, 12, 76, 494, 3662, 30574, 284398, 2918924, 32791604, 400400062, 5281683678, 74866857910, 1135063409918, 18330526475060, 314169905117860, 5695984717957246, 108921059813769710, 2190998123920252622, 46250325111346491694
Offset: 1
a(4) = 4: 4 2 1 3, 4 3 1 2, 4 1 3 2, 4 2 3 1.
a(5) = 12: 5 3 1 2 4, 5 2 3 1 4, 5 4 2 1 3, 5 2 4 1 3, 5 1 4 2 3, 5 2 1 4 3, 5 1 3 4 2, 5 3 1 4 2, 5 4 1 3 2, 5 3 4 1 2, 5 2 4 3 1, 5 3 2 4 1.
- Wayne M. Dymacek, Isaac Lambert and Kyle Parsons, Arithmetic Progressions in Permutations, http://math.ku.edu/~ilambert/CN.pdf, 2012. - From N. J. A. Sloane, Sep 14 2012
- Isaac Lambert, Table of n, a(n) for n = 1..50
- Wayne M. Dymáček and Isaac Lambert, Circular Permutations Avoiding Runs of i, i+1, i+2 or i, i-1, i-2, Journal of Integer Sequences, Vol. 14 (2011), Article 11.1.6.
- Sean A. Irvine, Java program (github)
- N. J. A. Sloane, FORTRAN program
- Index entries for sequences related to shoe lacings
A002816
Number of polygons that can be formed from n points on a circle, no two adjacent.
Original entry on oeis.org
1, 0, 0, 0, 1, 3, 23, 177, 1553, 14963, 157931, 1814453, 22566237, 302267423, 4340478951, 66541218865, 1084982173641, 18752743351339, 342523093859011, 6593167693927885, 133408305489947029, 2831112931136162775, 62878579846490149375, 1458746608689369440265
Offset: 1
a(6)=3: 135264, 136425, 142635.
- P. Poulet, Reply to Query 4750, Permutations, L'Intermédiaire des Mathématiciens, 26 (1919), 117-121.
- N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
- T. D. Noe, Table of n, a(n) for n = 1..100
- B. Aspvall and F. M. Liang, The dinner table problem, Technical Report CS-TR-80-829, Computer Science Department, Stanford, California, 1980.
- D. P. Robbins, The probability that neighbors remain neighbors after random rearrangements, Amer. Math. Monthly 87 (1980), 122-124.
- Eric Weisstein's World of Mathematics, Cycle Complement Graph
- Eric Weisstein's World of Mathematics, Hamiltonian Cycle
- Index entries for sequences related to shoe lacings
-
dinner := proc(n) local j,k,sum; sum := (n-1)!/2 + (-1)^n; for k from 1 to n-1 do for j from 1 to min(n-k,k) do sum := sum+(-1)^k*binomial(k-1,j-1)*binomial(n-k,j)*n/(n-k)*(n-k-1)!/2*2^j; od; od; end;
-
t = {1, 0, 0, 0, 1, 3, 23}; Do[AppendTo[t, ((n^3 - 8*n^2 + 18*n - 21) t[[-1]] + 4*n*(n - 5) t[[-2]] - 2*(n - 6) (n^2 - 5 n + 3) t[[-3]] + (n^2 - 7*n + 9) t[[-4]] + (n - 5) (n^2 - 5*n + 3) t[[-5]])/(n^2 - 7*n + 9)], {n, 8, 25}]; t (* T. D. Noe, Jan 04 2012 *)
Join[{1, 0}, RecurrenceTable[{a[3] == 0, a[4] == 0, a[5] == 1, a[6] == 3, a[7] == 23, (n^2 - 7 n + 9) a[n] == (n^3 - 8 n^2 + 18 n - 21) a[n - 1] + 4 n (n - 5) a[n - 2] - 2 (n - 6) (n^2 - 5 n + 3) a[n - 3] + (n^2 - 7 n + 9) a[n - 4] + (n - 5) (n^2 - 5 n + 3) a[n - 5]}, a, {n, 3, 20}]] (* Eric W. Weisstein, Feb 26 2021 *)
Entry improved by Michael Steyer (m.steyer(AT)osram.de), Aug 30 2001
A089222
Number of ways of seating n people around a table for the second time without anyone sitting next to the same person as they did the first time.
Original entry on oeis.org
1, 0, 0, 0, 0, 10, 36, 322, 2832, 27954, 299260, 3474482, 43546872, 586722162, 8463487844, 130214368530, 2129319003680, 36889393903794, 675098760648204, 13015877566642418, 263726707757115400, 5603148830577775218, 124568968969991162100, 2892414672938546871250
Offset: 0
Udi Hadad (somebody(AT)netvision.net.il), Dec 22 2003
a(4)=0 because trying to arrange 1,2,3,4 around a table will always give a couple who is sitting next to each other and differ by 1.
- J. Snell, Introduction to Probability, e-book, pp. 101 Q. 20.
- Vincenzo Librandi, Table of n, a(n) for n = 0..200
- Art of Problem Solving forum, Random neighbors. - _Joel B. Lewis_, Jan 28 2010
- B. Aspvall and F. M. Liang, The dinner table problem, Technical Report CS-TR-80-829, Computer Science Department, Stanford, California, 1980.
- Charles M. Grinstead and J. Laurie Snell, Introduction to Probability.
- Vaclav Kotesovec, Non-attacking chess pieces, 6ed, 2013, p. 626.
- Roberto Tauraso, The Dinner Table Problem: The Rectangular Case, INTEGERS: Electronic Journal of Combinatorial Number Theory, Vol. 6 (2006), #A11. Note that in this paper a(1) = 1. See Column 2 in the table on page 3.
-
Same[cperm_, n_] := ( For[same = False; i = 2, (i <= n) && ! same, i++, same = ((Mod[cperm[[i - 1]], n] + 1) == cperm[[i]]) || ((Mod[cperm[[ i]], n] + 1) == cperm[[i - 1]])]; same = same || ((Mod[cperm[[n]], n] + 1) == cperm[[1]]) || ((Mod[ cperm[[1]], n] + 1) == cperm[[n]]); Return[same]); CntSame[n_] := (allPerms = Permutations[Range[n]]; count = 0; For[j = 1, j <= n!, j++, perm = allPerms[[j]]; If[ ! Same[perm, n], count++ ]]; Return[count]);
(* or direct computation of terms *)
Table[If[n<3, 0, n! + (-1)^n*2n + Sum[(-1)^r*(n/(n-r))^2 * (n-r)! * Sum[2^c * Binomial[r-1,c-1] * Binomial[n-r,c], {c,1,r}], {r,1,n-1}]], {n,1,25}] (* Vaclav Kotesovec, Apr 06 2012 *)
A326404
Triangle T(n,k) read by rows: T(n,k) = number of ways of seating n people around a table for the second time so that k pairs are maintained. Rotated sequences are counted as one.
Original entry on oeis.org
1, 0, 1, 0, 0, 1, 0, 0, 0, 2, 0, 0, 4, 0, 2, 2, 0, 10, 10, 0, 2, 6, 24, 30, 40, 18, 0, 2, 46, 140, 224, 182, 98, 28, 0, 2, 354, 1088, 1480, 1280, 604, 192, 40, 0, 2, 3106, 9000, 12006, 9450, 4878, 1494, 330, 54, 0, 2, 29926, 83480, 107170, 82840, 41620, 14152, 3100, 520, 70, 0, 2
Offset: 0
Assuming the initial order was {1,2,3,4,5} (therefore 1 and 5 form a pair as the first and last persons are neighbors in the case of a round table) there are 5 sets of ways of seating them again so that 3 pairs are conserved: {1,2,3,5,4}, {2,3,4,1,5}, {3,4,5,2,1}, {4,5,1,3,2}, {5,1,2,4,3}. Since within each set we do not allow for circular symmetry (e.g., {1,2,3,5,4} and its rotation to form {2,3,5,4,1} are counted as one) but we allow reflection ({1,2,3,5,4} and {4,5,3,2,1} are considered distinct), the total number of ways is 5*2 and therefore T(5,3)=10.
Unfolded table with n individuals (rows) forming k pairs (columns):
0 1 2 3 4 5 6 7
0 1
1 0 1
2 0 0 1
3 0 0 0 2
4 0 0 4 0 2
5 2 0 10 10 0 2
6 6 24 30 40 18 0 2
7 46 140 224 182 98 28 0 2
Sum of n-th row is
A000142(n-1) for n > 0.
Cf.
A326390 (accounting for rotation and reflection symmetry),
A326397 (disregards reflection symmetry but allows rotation),
A326411 (disregards both reflection and rotation symmetry).
Showing 1-4 of 4 results.
Comments