"A few days ago, I came across this problem" - well, volume 4A of The Art of Computer Programming was published in 2011, which gives a pretty good treatment of the Langford Pairs. The author might've made their reference clear, and called out that the Python implementation was their own contribution
Hello! I am the author of this post and I did not have access to volume 4A of the Art of Computer Programming. Therefore I could not have made a reference to that book. In fact, I've never read that book.
This particular problem was shared by a colleague of mine in an internal mathematics puzzle forum. This was back in the days when my friends, some of my colleagues, and I were much younger and going through a phase in our lives when we used to challenge each other with mathematical puzzles. This blog post was a response to one such challenge.
The solution is my own. How similar do you find this solution to the one in Knuth's book? If it is indeed very similar, I would be a little amused but not too surprised because I think the approach I laid out in my solution is one of the few obvious paths to a solution. In fact, some of my colleagues independently came up with very similar proofs for the necessary condition.