View unanswered posts | View active topics
It is currently Sun Jun 15, 2025 6:03 pm
Author |
Message |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
Thought I'd create an branch from Fin's exam thread. http://projecteuler.net/index.php?section=aboutProject 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 managed problem 1 and 5 so far as they're the only ones I've tried  I don't know if many people will do these from this forum but please post in spoiler colours (i.e. white) if you have the solution or provide hints etc...
|
Wed Mar 24, 2010 12:55 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
OK, done 2 and 6 now  Need to do some work now though.
|
Wed Mar 24, 2010 1:21 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
and now 8  I need to do some of these in Java as the language I use at work isn't up to much number crunching.
|
Wed Mar 24, 2010 1:30 pm |
|
 |
finlay666
Spends far too much time on here
Joined: Thu Apr 23, 2009 9:40 pm Posts: 4876 Location: Newcastle
|
I did one, I have a solution to 282 HOWEVER I need to change it from recursive to iterative as doing it recursively causes a stack overflow  I'd suggest doing one easy then one hard 
_________________TwitterCharlie Brooker: Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.
|
Wed Mar 24, 2010 2:00 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
Yeah, after a few lines I realised that it would be possible to work out what the final value is fairly easily by viewing it as a whole rather than individual A(m,n) functions.
Will have a go tonight.
Will be interesting to compare code (although I'll be in Java or ObjC).
|
Wed Mar 24, 2010 2:52 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
OK, aiming for 282 and then 11 tonight. 11 is a bit less numbery but a bit more interesting 
|
Wed Mar 24, 2010 3:49 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
LOL, well it ran for about 5 minutes and then crashed 
|
Wed Mar 24, 2010 6:39 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
Well, I'm stuck. I can't seem to work out how to get this to work  Hmm... I wonder if there is a way of storing results into an array and so enabling the algorithm to grab the results without having to run the same iterations over and over.
|
Wed Mar 24, 2010 8:01 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
OK, this is good! Definitely a step forward! I can get the result from A(5,0) in around half a second now.
|
Wed Mar 24, 2010 8:26 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
OK, I can run up to A(5,0) or A(4,2) and it runs very quickly. A(5,0) runs in 0.005 seconds. However, if I try to increase any side of these then I get a bad access error. 
|
Wed Mar 24, 2010 9:03 pm |
|
 |
finlay666
Spends far too much time on here
Joined: Thu Apr 23, 2009 9:40 pm Posts: 4876 Location: Newcastle
|
OK, I can run up to A(5,0) or A(4,2) and it runs very quickly. A(5,0) runs in 0.005 seconds. However, if I try to increase any side of these then I get a bad access error.  [/quote] but it's i,i not i, j so 1,1 2,2 3,3 4,4 5,5 6,6 and 0,0
_________________TwitterCharlie Brooker: Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.
|
Wed Mar 24, 2010 9:57 pm |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
Yeah  I figured if I could reduce the number of iterations done it would stop it crashing out. I can't work out how to do it any other way? It's kind of like the Towers of Hanoi problem in a way. Each time you increase a number it does everything before it again or soemthing. Fin, have you done this one yet?
|
Wed Mar 24, 2010 9:58 pm |
|
 |
finlay666
Spends far too much time on here
Joined: Thu Apr 23, 2009 9:40 pm Posts: 4876 Location: Newcastle
|
No, at my gf's atm as my main pc has VS2008 C++ installed and my laptop only has C# (C++ I can increase the call stack to 1gb or so  ) It's not iteratively that causes the problem, it's the recursion that is the problem and a stack overflow exception as a result, I have thought of a solution that is more iterative but will give it a shot when I get home. (combination of for/while loops to achieve the result which *SHOULD* not give the error) Did 4 today, so 1,2,6,8,9 and 16 so far The latter challenges are the ranked ones too btw so they may be worth a look for a challenge 16 was a bit of a tricky one in C# due to the double refactoring to scientific notation automatically, got it in the end though 
_________________TwitterCharlie Brooker: Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.
|
Thu Mar 25, 2010 12:22 am |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
I got number 9 done this morning.
|
Thu Mar 25, 2010 9:01 am |
|
 |
Fogmeister
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 7:35 pm Posts: 6580 Location: Getting there
|
I gave up on 282 for now. Having a go at problem 17 and I've got an answer but it tells me it's wrong  I've double and triple checked my program and I can't find anything wrong. I've even double checked against several random numbers and it's doing it correctly. Not sure what to do now?
|
Thu Mar 25, 2010 10:41 am |
|
|
Who is online |
Users browsing this forum: No registered users and 14 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum
|
|