Skip to content

Repository files navigation

cl-problem-solving

Hobby project using Common Lisp to solve numeric puzzles as those proposed by Project Euler.

When relevant, an optimized solution, compiling with no note under (speed 3) is proposed.

A test suite is proposed.

Table of contents:

Any comment? Open an issue, or start a discussion here or at profile level.

Usage

Register the project with ASDF, from the REPL or once and for all in your .sbclrc:

(push #P"c:/.../cl-problem-solving/" asdf:*central-registry*)

Then load it and solve everything at once:

(asdf:load-system :cl-problem-solving)
(cl-problem-solving:main)

Each problem is exported individually. Where a plainer version is kept beside the optimized one, its name carries a -- suffix saying what it is:

(cl-problem-solving:project-euler-001)                 ; => 233168
(cl-problem-solving:project-euler-001--not-optimized)  ; same answer, plainer code
(cl-problem-solving:project-euler-001 10)              ; => 23

To run the test suite:

(asdf:test-system :cl-problem-solving)
(parachute:test :cl-problem-solving-tests)             ; same, directly

Project Euler

Project Euler problems solved are: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 80, 81, 89, 254, 684.

Other puzzles

  • Anecdotes Maths — Mathematical anecdotes and curiosities from @AnecdotesMaths
  • Certificat — Josephus problem
  • Devil Calculator — Devil Math Facts
  • Fermat's Library — Number theory curiosities from @fermatslibrary
  • Ile Maths — French number-to-words conversion

Tupper formula

Blog post: https://www.effectivelambda.org/en/blog/006-tuppers-self-referential-formula.html

Tupper's self-referential formula is a formula that visually represents itself when graphed on plane.

See Wikipedia or Wolfram MathWorld.

Formula:

formula

SBCL supports 'big' integers, which allows implementing the formula directly:

code

Output:

output

I have added this code to Rosetta Code.

License

Copyright (c) 2025 Nicolas Occis

Licensed under the MIT License.

(end of README)

About

Hobby project using Common Lisp to solve numeric puzzles as those proposed by Project Euler.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages