Emuforums.com

Go Back   Emuforums.com > General Discussion > Web development / Programming
Home Register Downloads FAQ Members List Calendar Arcade Mark Forums Read

Reply
 
Thread Tools Display Modes
Old July 22nd, 2010, 09:50   #1
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,387
Project Euler

Has anyone here ever heard of Project Euler?
Project Euler

Essentially its a collection of computer science/math/programming problems which can be solved in any way you choose (c++, java, asm, mathematical analysis, etc...)

You sign-up and try and solve as much problems as you can.
Once you answer the correct question, you are able to access a forum-thread for that specific problem, where people list their own solutions to the problems. Often times you can learn more optimized ways to code your algorithm from looking at the way other people did it.

I've been solving project-euler problems in my free-time for about 2 weeks now and have solved 30 problems so-far.
I think some of you might also enjoy the challenge, so check it out!
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog
cottonvibes is offline   Reply With Quote

Advertisement [Remove Advertisement]

Old July 22nd, 2010, 10:43   #2
@ruantec
Crazy GFX coder
 
@ruantec's Avatar
 
Join Date: Nov 2002
Location: Dominican Republic/Austria
Posts: 8,282
mmmm sounds interesting... i may give a try one of this days. thank you for the link cotton
__________________


Current development tools:

Visual C++.net, Visual C#.net
Visual VB.net, Visual Webdeveloper.net
Bloodshed Dev C++, Borland C++
Visual Basic 6
@ruantec is offline   Reply With Quote

Old July 23rd, 2010, 03:13   #3
fried_egg
Registered User
 
fried_egg's Avatar
 
Join Date: Apr 2007
Location: indiana
Posts: 694
i will do this.
fried_egg is offline   Reply With Quote

Old July 23rd, 2010, 04:27   #4
runawayprisoner
Level 9998
 
runawayprisoner's Avatar
 
Join Date: Nov 2006
Location: Java
Posts: 9,377
Problem 299 is killing my Macbook...

How on Earth did someone use Java to solve it under 60 seconds...? 100,000,000 gives over billions of different cases to examine...

I'm gonna have a grand time looking at the different ways people solved it.
runawayprisoner is offline   Reply With Quote

Old July 23rd, 2010, 15:18   #5
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,387
oh yeah i forgot to mention, every problem is designed to be solvable in under 1 minute if you use an efficient algorithm.

the easier problems can be solved using brute-force/exhaustive-search, however the harder ones must be solved using an efficient algorithm because no pc can calculate the results of some of the harder problems in under 1-minute using brute-force alone.
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog
cottonvibes is offline   Reply With Quote

Old July 23rd, 2010, 18:52   #6
runawayprisoner
Level 9998
 
runawayprisoner's Avatar
 
Join Date: Nov 2006
Location: Java
Posts: 9,377
Well got my results after a few hours. Obviously there are more efficient ways of doing it, I'm trying to develop a precise algorithm now...

The problem lies in the way some problems need to be proven or verified...
runawayprisoner is offline   Reply With Quote

Old July 23rd, 2010, 18:55   #7
TitanKvad
雨の中にいる Pastafarai!
 
Join Date: Mar 2008
Location: ノルウェー王国
Posts: 128
Looks pretty interesting. Shall check this out
__________________
Check mah muzaks (norwegian nerdcore drum'n'bass-rap)
Myspace / Soundcloud / Youtube / Slask Studio
∀x((your(x)∧base(x))→arebelongto(x,us))
リンクをクリックしてお願いします。(日本語悪くてすみません)
TitanKvad is offline   Reply With Quote

Old July 24th, 2010, 03:04   #8
serge2k
Registered User
 
Join Date: Sep 2006
Location: surrey
Posts: 111
UVa has a set of similar problems.

http://uva.onlinejudge.org/
serge2k is offline   Reply With Quote

Old July 26th, 2010, 07:17   #9
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,387
so anybody actively doing this still? xD
just got to level 2, solved 50 problems so far!


i've been using c++ for these problems, but i think a lot of these problems are best solved using languages that support big-integers and easy integer-to-string operations.
i found some random BigInteger class library for c++ which i've been using to solve some of the problems, but the problem is its super slow (the library's goal was readability, not speed), so many times i have to rely on other alternatives to solve the problems.

Many of the problems dealing with huge numbers (numbers with thousands or millions of digits) don't require you to compute the full-precision values.
usually you can just MOD the results with 10^10 and only keep the lower 10 digits valid during your computations.


so far all my solutions have a run-time of under a minute, most are under 1 second.
i feel bad when i can't get some of the programs running under a second, but oh well.
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog
cottonvibes is offline   Reply With Quote

Old July 26th, 2010, 18:27   #10
Boltzmann
Retired
 
Boltzmann's Avatar
 
Join Date: Jan 2003
Location: Jundiaí - São Paulo - Brazil
Posts: 8,876
Seems very interesting. I'll take a look later, but I'm guessing my incipient programming knowledge will probably prevent me from going very far.
__________________
"Let be be finale of seem.
The only emperor is the emperor of ice-cream."

- Wallace Stevens

Me on Twitter
Boltzmann is offline   Reply With Quote

Old July 26th, 2010, 19:44   #11
@ruantec
Crazy GFX coder
 
@ruantec's Avatar
 
Join Date: Nov 2002
Location: Dominican Republic/Austria
Posts: 8,282
Am planning to give a check but right now am very busy with something you're going to see by the end of this week after that i guess am going to have some free time to spend solving some of them.
__________________


Current development tools:

Visual C++.net, Visual C#.net
Visual VB.net, Visual Webdeveloper.net
Bloodshed Dev C++, Borland C++
Visual Basic 6
@ruantec is offline   Reply With Quote

Old July 26th, 2010, 21:54   #12
Boltzmann
Retired
 
Boltzmann's Avatar
 
Join Date: Jan 2003
Location: Jundiaí - São Paulo - Brazil
Posts: 8,876
Which language would be most suited to these problems, anyway?

cottonvibes says that C++ is not the optimal language, so what would qualify as a language "that support big-integers and easy integer-to-string operations"?
__________________
"Let be be finale of seem.
The only emperor is the emperor of ice-cream."

- Wallace Stevens

Me on Twitter
Boltzmann is offline   Reply With Quote

Old July 26th, 2010, 22:55   #13
serge2k
Registered User
 
Join Date: Sep 2006
Location: surrey
Posts: 111
Java.


I have solved 1-10, 14,16,18,20,25,29, and 67.
serge2k is offline   Reply With Quote

Old July 26th, 2010, 23:22   #14
Boltzmann
Retired
 
Boltzmann's Avatar
 
Join Date: Jan 2003
Location: Jundiaí - São Paulo - Brazil
Posts: 8,876
Damn, I'm clueless about Java. This should be an opportunity for learning, though, as soon as I finish some work-related projects...
__________________
"Let be be finale of seem.
The only emperor is the emperor of ice-cream."

- Wallace Stevens

Me on Twitter
Boltzmann is offline   Reply With Quote

Old July 27th, 2010, 02:00   #15
Proto
Knowledge is the solution
 
Proto's Avatar
 
Join Date: Dec 2002
Location: Pittsburgh, US. Previously in Mexico City
Posts: 7,160
AFAIK people use a multitude of languges to solve this, and none can be said to be better than the other. You'll see most people using some C family language or Java, but I've seen people sloving them using Scheme and Ocaml. Personally I was going to use these problems as an excersice since I've been learning some Haskell.
__________________
Proto is offline   Reply With Quote

Old July 27th, 2010, 02:04   #16
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,387
Quote:
Originally Posted by Boltzmann View Post
Which language would be most suited to these problems, anyway?

cottonvibes says that C++ is not the optimal language, so what would qualify as a language "that support big-integers and easy integer-to-string operations"?
a lot of the people that have submitted solutions seemed to have enjoyed using mathematica.

python looks like a nice language to use since it natively supports big integers, and the solutions using it look simple.
ruby is another language with built-in big number support that looks like it would be good to use.

i haven't tried python or ruby; but i know psxAuthor really likes ruby, so i'll take his word that its good.

both java and c# have big integer classes; i would learn c# over java if you pick one of those.
if you prefer functional programming languages, then f# supports big integers (but i hate functional programming).


The shortest solutions are from people using the programming language J.
Lots of times the solution in J is just 1-line of less than 20 characters, whereas the solution in other languages would be 20+ lines.
The code looks crazy though, here is an example of a solution in J:
Code:
_10{.":+/^~>:i.999x
also, although i haven't used it, matlab would probably be good to use as well.


that said, you can technically use almost any language, including assembly (which a few people seem to use for their solutions), but the ones i listed above are the ones that seem more suited to the task.

if you have good math analytical skills, there's a number of problems that can be solved by hand, but many are designed to be solved by computers.

Quote:
Originally Posted by serge2k View Post
I have solved 1-10, 14,16,18,20,25,29, and 67.
nice
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog

Last edited by cottonvibes; July 27th, 2010 at 02:04.. Reason: Automerged Doublepost
cottonvibes is offline   Reply With Quote

Old July 27th, 2010, 14:46   #17
serge2k
Registered User
 
Join Date: Sep 2006
Location: surrey
Posts: 111
I should note that we did 67 (and the related one) at an ACM practice before. So I didn't really do it myself.
serge2k is offline   Reply With Quote

Old July 27th, 2010, 16:00   #18
Grv
Translator
 
Grv's Avatar
 
Join Date: Dec 2003
Location: Холандија
Posts: 1,576
What a great idea, bookmarked. Thanks for the links, cottonvibes and serge2k.
__________________
I'm not young enough to know everything.

Grv is offline   Reply With Quote

Old July 27th, 2010, 18:51   #19
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,387
Quote:
Originally Posted by serge2k View Post
I should note that we did 67 (and the related one) at an ACM practice before. So I didn't really do it myself.
I did an ACM problem for extra credit in my Programming III class that was similar to problem 67 but a lot harder.
I ended up modifying that code to solve problem 67 (and problem 18 with the smaller triangle).

So far, i've found problem 31 to be one of the most annoying problems on project euler. I had to read online about integer partitioning to solve it.

Problem 79 was one of the funner ones since I did that one by hand (and that's probably the best way to solve it).
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog
cottonvibes is offline   Reply With Quote

Old August 2nd, 2010, 02:45   #20
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,387
update:
solved 75 problems so far

25 more problems to go before level 3 :o
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog
cottonvibes is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 01:12.

© 2006 - 2012 Emu Forums | About Emu Forums | Advertisers | Investors | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.