aspose file tools*
The moose likes Programming Diversions and the fly likes Project Euler: Programming and math puzzles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Project Euler: Programming and math puzzles" Watch "Project Euler: Programming and math puzzles" New topic
Author

Project Euler: Programming and math puzzles

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14268
    
  21

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
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.


Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
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 :-)


Ping & DNS - my free Android networking tools app
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14268
    
  21

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

Joined: Oct 02, 2003
Posts: 11406
    
  16

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.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Peter van de Riet
Ranch Hand

Joined: Apr 09, 2004
Posts: 112

Just a long shot:
0! = 1


Each number system has exactly 10 different digits.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11406
    
  16

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

Joined: Mar 24, 2008
Posts: 3838

I have also just started at Project Euler. Seems really interesting...


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Maris Orbidans
Ranch Hand

Joined: Mar 08, 2004
Posts: 149
Jesper Young wrote:I've written my solutions mostly in Ruby and Scala.
[


write in clojure next time !!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Project Euler: Programming and math puzzles