Project Euler

For a long time I have wanted to improve my programming skills. Well, skills might be a overstatement. I have had two short introductory programming courses during my many years at uni, one C++ and one Java. But after the course is over I stop programming, since there are no more hand-ins, and as a result I quickly forget even the basics.

So now my hope is that if I spend one or two hours a week working with some problems (with a math twist to keep my focus) I will pick up the basics and get more familiar with Java (the programming language that I have chosen to start out with).

So I have started working the problems at Project Euler. I haven’t spend that much time working the problems yet, but I have solved the first two (using very brute force and non-elegant code), but it seems I have to do a bit of thinking for the third problem. Somehow working through all the integers from one to 600,851,475,143, check if they are a factor of 600,851,475,143 and then check if that factor is a prime is not the most optimal way to find the largest prime factor of 600,851,475,143. Back to the drawing board…

Of course I could ‘cheat’ and just do

$ factor 600851475143

in a shell, but that way I won’t learn much…

leonhard_euler

I first heard about Project Euler at the xkcd blag, but haven’t had the time to look into it before now.

If you know of other interesting problems useful for brushing up on a programming language, feel free to leave a comment.

And before I forget, a big thanks goes out to Søren, who has been very patient with my basic questions like “how do I check if one or the other condition is fulfilled in my if statement?”. I promise, I’ll pick up a book soon and stop bothering you with trivialities on chat!