Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Project Euler: Programming and math puzzles

 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15205
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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: 15205
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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: 12083
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a long shot:
0! = 1
 
fred rosenberger
lowercase baba
Bartender
Posts: 12083
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have also just started at Project Euler. Seems really interesting...
 
Maris Orbidans
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper Young wrote:I've written my solutions mostly in Ruby and Scala.
[


write in clojure next time !!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic