Add README.md and LICENSE.
This commit is contained in:
58
README.md
Normal file
58
README.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# Partridge
|
||||
|
||||
The inspiration for this project is Stand-up Maths' YouTube video
|
||||
[The impossible 2025 puzzle with over a million solutions](https://youtu.be/eqyuQZHfNPQ?si=hbOQdVKBC-jwvysk).
|
||||
|
||||
In the video Matt Parker shows solutions to the 8th and 9th Partridge
|
||||
problems, and claims that solutions exist for all Partridge problems from
|
||||
size eight and above. (There are no solutions to Partridge problems when N < 8).
|
||||
|
||||
Whilst I could see how you can get from a solution to the 2N-th problem to the
|
||||
(2N+1)th problem I couldn't immediately see that a solution to the 8th & 9th
|
||||
problems indicate that there would be a solution to the 10th or 12th.
|
||||
|
||||
So I set out to write some code that finds a solution to the Partridge problem.
|
||||
|
||||
Originally
|
||||
[I wrote an OCaml version](https://gitea.gretton-dann.org.uk/mgrettondann/partridge-cpp.git)
|
||||
of the code. However, my estimate of how long it would take to calculate a
|
||||
solution to the 10th Partridge problem was around 36 hours on my Macbook Air.
|
||||
So I moved to C++ which seems to be providing a 3x speed-up just by doing a
|
||||
straight translation of the code. There are some further optimisations in the
|
||||
C++ source which suggest finding a solution to the 10th Partridge problem will take
|
||||
around 6 hours.
|
||||
|
||||
## Copyright & Licence
|
||||
|
||||
This code is copyright 2025 Matthew Gretton-Dann. Licensed under the
|
||||
[Apache-2.0 license](./LICENSE).
|
||||
|
||||
## Running the code
|
||||
|
||||
### Prerequisites
|
||||
|
||||
You must have `git`, `cmake`, `make` and a compiler capable of compiling C++20 code
|
||||
on your path.
|
||||
|
||||
### Code checkout and setup.
|
||||
|
||||
It is strongly recommended that you make a Release build as shown in the
|
||||
instructions below. The code is extremely slow in debug builds.
|
||||
|
||||
```sh
|
||||
git clone https://gitea.gretton-dann.org.uk/mgrettondann/partridge-cpp.git
|
||||
cmake -B build -S partridge-cpp -DCMAKE_BUILD_TYPE=Release
|
||||
```
|
||||
|
||||
### Building
|
||||
|
||||
```sh
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
### Executing
|
||||
|
||||
```sh
|
||||
N=9 # Set N to largest size of square.
|
||||
./build/partridge_cpp $N
|
||||
```
|
||||
Reference in New Issue
Block a user