I have tried to generalize these solutions somewhat, so they can be repurposed later. Each subdirectory of ans
is numbered according to the problem it solves on Project Euler. Presently, I have only a few problems solved. If in the future this number grows, I will most likely fork this repository and make it private, leaving only the first 100 open for outside examination.
- This is all under the Go module
aaheen/euler
. main
accesses answers through theans
package, through theSol(p int)
andAsk(p int)
functions, wherep
is the problem number.- Each problem is contained in its own sub-package of
ans
, namedp<number>
. - Example: The full name for the package that contains the solution for Problem 3 is
m9ple/euler/ans/p3
. To get the exact answer for Problem 3, callans.Sol(3)
. To run the interactive session for Problem 3, callans.Ask(3)
. - Note: All of the
$$
you see in problem READMEs is just unrendered LaTeX. GitHub does not currently support any easy method of rendering LaTeX. This is such a hotly demanded feature that I have to believe they will implement it sometime relatively soon.
A command line utility used to run any implemented solution and open URLs to specific problems this repo. All solutions are compiled into it, so it's portable.
The ans
package just grabs from two big map[int]func()
(declared in probmap.go), where the index corresponds to the problem number. I have struggled trying to come up with a more elegant implementation, but right now I'm not sure what that would be.
euler <p> - Run the solution for problem <p>. Directly outputs answer
-i <p> - Run the interactive solution session for problem <p>
-g - Open this repo at github.com/m9ple/euler
-g <p> - Open the subdirectory for problem <p> on github.