# Project Euler: Programming and math puzzles

Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15495
43
I don't visit the Programming Diversions forum often, but here's something that really belongs here: Project Euler.
What is Project Euler?

Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

The motivation for starting Project Euler, and its continuation, is to provide a platform for the inquiring mind to delve into unfamiliar areas and learn new concepts in a fun and recreational context.

I've just discovered that website myself and haven't looked at any of the puzzles yet, but it does sound interesting.

Garrett Rowe
Ranch Hand
Posts: 1296
Project Euler is a very cool site. Its language agnostic, you can even solve the problems with a pen and paper (if you're a glutton for punishment). When I am starting to pick up a new programming language, one exercise I like to do is run through a few P.E. problems in the language. It helps me feel my way around the new syntax while still allowing me to feel like I'm doing something worthwhile. Actually, I've done the first 30 problems (mostly in Haskell and Scala, with 3 or 4 done in Java) and I'm currently stuck trying to figure out an algorithm for 31. I may just skip it and move on.

Ulf Dittmer
Rancher
Posts: 42968
73
Yep, the site is cool if you're into math and algorithms. I've only done a dozen or so, amongst them #31: my approach uses intelligent brute force :-)

Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15495
43
I've solved a few of the problems and I've found that it's a great way to practice new programming languages as you say, Garrett. I've written my solutions mostly in Ruby and Scala.

Most of the first questions are solvable by brute force, but ofcourse the idea is to think a little further to find a faster and more elegant solution.

fred rosenberger
lowercase baba
Bartender
Posts: 12203
35
I have solved the first 33, plus #67 (it's trivial if you've done #18 'correctly' - I didn't have to change a thing in my program, i just passed a new file name as a parameter).

I'm working on #34. What's interesting is that right now, my program finds exactly ONE Factorion (note - link gives you the final answer if you read enough). For some reason, my code fails to find the second (i'm not counting 1 or 2, since the direction explicitly exclude them).

I am really enjoying this. Even though I've worked with java for about 7 years, I'm learning a lot going through these.

I'm tempted to try them in Haskell, but I also would like to finish them through once in a single language, else i never will.

Peter van de Riet
Ranch Hand
Posts: 112
Just a long shot:
0! = 1

fred rosenberger
lowercase baba
Bartender
Posts: 12203
35
you are indeed correct.

that's one of those facts i knew at one point, but forgot.

What's nice about a lot of these problems is you can use some of your code over again. My next problem asks about all primes below 1,000,000. One of the earlier problems asked about all primes below 2,000,000. should be simple(r).

Vijitha Kumara
Bartender
Posts: 3918
10
I have also just started at Project Euler. Seems really interesting...

Maris Orbidans
Ranch Hand
Posts: 149
Jesper Young wrote:I've written my solutions mostly in Ruby and Scala.
[

write in clojure next time !!!