Euler problems in functional Python


The Euler Project proposes some mathematical problems to be solved using any programming language. In this wiki, we will see and discuss solutions using Python and Functional Programming style. If functional programming is unfamiliar to you, take a look on these references and discover this exciting paradigm (1, 2, 3, 4).

Important note: Python is not a functional language, so some (many, I am afraid) of the solutions here won't be Pythonic. The fibonacci generator is perhaps the more clear example; while a simple while loop will suffice when using imperative code, we will need to look for functional alternatives. So, if you are learning Python this may be not the best place to start. But if you know Python and want to explore its functional possibilities, it may be interesting.

Source code

Since a wiki is not the best way to share code, I've moved the solutions to Pyeuler in Github:


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License