Counting Langford pairings for 31 and 32 pairs
Compute the exact number of Langford pairings of order 31 and 32, estimated near 5×10^24 and 9×10^25; counts are known up to order 28.
Counting Langford pairings for 31 and 32 pairs
Arrange two 1s, two 2s, up to two $n$s in a row so that the two copies of have exactly numbers between them. How many such arrangements are there? The counts are known up to ; the next cases, and , are estimated at about and but have never been computed exactly.
Problem
A Langford pairing of order is a sequence of length in which each occurs exactly twice and the two occurrences of are separated by exactly other entries. For , 41312432 is one. A pairing and its reversal are counted once. Let be the number of pairings. Pairings exist only when or , so the next unknown values are and . Compute them exactly.
Background
C. Dudley Langford posed the problem in the Mathematical Gazette in 1958 after watching his son stack coloured blocks, and Roy O. Davies (1959) showed that solutions require or . Martin Gardner brought it to a wide audience in 1967, and counting has since been a benchmark for exhaustive search: by hand and early computers for , then with growing parallel computations for and . It is problem 24 of CSPLib, proposed by Toby Walsh, which also covers the generalisation to triples and higher multiplicities. It is OEIS sequence A014552.
What is known
- Exact counts are known for all . The largest are and , computed by Assarpour, Barnoy and Liu (2015).
- The same paper estimates and by parallel tempering, with an error below one percent on the known values. John E. Miller's Langford page, which tracks the history, lists 31 and 32 as the next targets and all as unknown.
- The planar pairings, whose connecting arcs can be drawn without crossings, were counted for and in 2018.
- Zan Pan (2021) proposed an asymptotic formula for the number of Langford and Skolem sequences.
What would count as progress
- The exact value of or , with the code and a description of the method. Since a single number cannot be checked by inspection, the claim should come with an independent confirmation: two different algorithms or implementations agreeing, or a run that others can reproduce, together with consistency checks such as matching all known values of for .
- A new exact counting method that reproduces the known values of much faster than earlier programs, bringing within reach.
References
- C. D. Langford (1958). Problem. The Mathematical Gazette 42, 228. https://doi.org/10.2307/3610395
- R. O. Davies (1959). On Langford's problem (II). The Mathematical Gazette 43, 253–255. https://doi.org/10.1017/S0025557200041693
- A. Assarpour, A. Barnoy and O. Liu (2015). Counting Skolem sequences. arXiv:1507.00315. https://arxiv.org/abs/1507.00315
- J. E. Miller, Langford's problem (web page with history and tables). https://dialectrix.com/langford.html
- OEIS A014552, Number of solutions to Langford (or Langford-Skolem) problem. https://oeis.org/A014552
Source
Imported from CSPLib prob024, curated by CSPLib editors. Open according to the source as of 2026-10-20. The statement above is written in our own words; see the source for the original wording, history and discussion.