Skip to content

xfbs/euler

Repository files navigation

Project Euler Solutions Build Status GitHub release Documentation

This is a repository of solutions to Project Euler problems. All of these solutions are written by me in an attempt to fool around with mathematics and sharpen my programming skills in a few languages.

Rules

  • A solution is only accepted when it:
    • yields the correct answer.
    • takes less than 1s (1000ms) to compute the answer. There are some solutions in here that take longer, because I couldn't (yet) get them there.
    • is completely written by myself, without having looked at someone else's solution (unless by accident). Don't wanna spoil the fun.
    • has a full and working testing suite. I like my code tested.
    • is well-documented, meaning that when reading it, it's obvious to see what is going on because the variables are named smartly and there comments to explain what is going on when necessary.
    • is elegant, meaning no more complex than it should be
  • Every language needs to be treated with respect by trying to use its idioms as much as possible and by avoiding hackery. That's kind of the point of this project — getting familiar with some dope new languages and their cool tricks
  • Code can be shared between solutions if it helps keeping things Dry.
  • When possible, the standard library of the language should suffice. I don't like depending on external libraries, especially when it can be useful to implement some things by myself. However, in some cases it's okay (for example, unit testing frameworks). When possible, I'll try to bundle external libraries into this repository.
  • The simpler the solution is, in terms of lines of code and complexity, the better.

Progress

See progress.md for more information.

Getting Started

See contributing.md for more information.

Languages

  • crystal, because it's pretty damn fast (thanks to LLVM, static typing and a lot of optimization, from what I can tell) — but yet also a pleasure to write because it has a ruby-esque syntax.
  • c, the grandfather of programming languages: because once you get into it, you can't escape it. I personally think it's a bit of a horrible and ancient language, but yet it's not so bad to write.
  • ruby, because it has a sweet, sweet syntax and it will always be my slow, but heartwarming favourite.
  • rust, because all the cool kids at Mozilla are doing it, and I like picking up fights with the compiler.
  • python, because it's Everybody's Favourite Language and I haven't spent much time with it recently.

Planned Languages:

  • chez scheme, because I never really worked with a scheme before and it's reportedly very fast. Edit: I might use a different flavour of Scheme, chicken scheme, because it seems a little more simplistic and doesn't have the overhead of an interpreter since it's compiled (although, it might be slower than chez).
  • idris, because it might be an interesting way to get into haskell, and it has support for some cool features like automagic proofs and a totality checker.
  • ocaml because I keep hearing about it in unexpected places and it got me curious.
  • nodejs because all the cool kids are doing it and my javascript is quite rusty.
  • java9 because that's what most people worldwide speak and while I'm really not a fan of java, they did add some features that make it interesting.
  • haskell, because it's just been on my to do list for too long.
  • risc5asm, because well you need to have done some assembly to be able to call yourself a 'real' programmer, and x86 assembler is too ordinaire for me and MIPS stopped being interesting 20 years ago.
  • cpp, because I haven't really gotten around to playing with C++14 and it could be okay.
  • swift, because it's seems cool even though it's from a major company and not some academic tech hippies. it might even be useful..
  • nim, because compiling to C, it has the potential to be rather quick but with a larger standard library, and with a python-esque syntax, also quite usable.
  • luajit, because I'm already familiar with lua and it claims to be the 'fastest dynamic language'.
  • dlang, because I've always been interested by it.

Other Repositories

There are some other people putting their solutions to project euler problems online, kudos to them because they have solved far more problems than I have:

These are useful to compare against after having solved a problem, to check if there is a more elegant or efficient method.

Acknowledgments

Apart from the great standard libraries of the languages that are used in this project, there are also a few support libraries used, which for now I have bundled into the repository:

License

See license.md for more information.