---
layout: post
status: publish
published: true
title: How to spend nights on the computer
author: Julien Lengrand-Lambert
author_login: jlengrand
author_email: julien@lengrand.fr
author_url: http://www.lengrand.fr
wordpress_id: 517
wordpress_url: http://www.lengrand.fr/?p=517
date: 2012-02-09 15:45:23.000000000 +01:00
categories:
- misc
- Python
tags:
- github
- project euler
- git
comments: []
---
Hi everyone,

As you may already know, I love solving problems. And what I love most is to use <strong><a title="kiss principle " href="http://en.wikipedia.org/wiki/KISS_principle" target="_blank">KISS principle</a></strong>, and reduce those problems into items so small that they all seem trivial.
Some time ago, as I was searching for a way to improve my programming skills, I fell on the<strong><a title="project Euler" href="http://projecteuler.net/" target="_blank"> Project Euler</a></strong>.

And since my life has never been the same :p.

The principle of Project Euler is simple : Solve a problem that takes <strong>only a few lines to explain</strong> in <strong>less than one minute</strong> using <strong>any tool</strong> you want (understand any programming language :p).

The first problems are trivial, but as you may expect get more and more complicated over time.
This is <strong>one of the best tools</strong> to be used if you want to<strong> learn about tricks for a given language</strong>. As you solve problems, you will find more and more difficult to pass the one minut limit. You will finally be forced to search for <strong>clever ways to solve your problems</strong> and this should lead you to beautiful code.
You will have to search for tricks such as <a title="generators python" href="http://wiki.python.org/moin/Generators" target="_blank">generators</a>, <a title="memoization" href="http://en.wikipedia.org/wiki/Memoization" target="_blank">memoization</a>, sieves, . . . which will surely lead you to be a better coder every day !

What I really love in Project Euler is how their problems are simple to understand, but challenging to be solved efficiently. Usually, the best solution is not the one you would have thought about :).

I decided to solve all my problems in <strong>Python</strong>, because it is simple and powerful. I felt in love with Python some time ago, and always feel like magic is going on when using it :).
As a motivation, and to share my achievements I keep <strong><a title="github pe" href="http://github.com/jlengrand/project_euler" target="_blank">sharing my solutions on github</a></strong> and try to document them as much as possible.

By now, I solved my <strong>36th problem</strong> yesterday and never spend a day without hacking for an hour or two :).
Try it, and let me know if you spend some nights solving problems too !

BTW, be careful because there are plenty of solutions on the web (including my github). I use others code only afterwards to check if they have popped out with a more elegant solution than mine.
(Ok, I cheated for the Dijkstra's algorithm; knowing that I had to use it but too lazy to implement it by myself. . . )

Enjoy ;)
