Reply to topic  [ 113 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 8  Next
Project Euler 
Author Message
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 5288
Location: ln -s /London ~
Reply with quote
Fogmeister wrote:
Having a go at problem 17 and I've got an answer but it tells me it's wrong

I've hacked something together for that now, and after realising that I can't count (even using fingers) it works.

_________________
timark_uk wrote:
Gay sex is better than no sex

timark_uk wrote:
Edward Armitage is Awesome. Yes, that's right. Awesome with a A.


Thu Mar 25, 2010 1:50 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
OMG I'm could kick myself!

I missed 18!

Project 14 is my next victim :D

I've done 1, 2, 5, 6, 7, 8, 9 and 17 now :D

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Thu Mar 25, 2010 3:10 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 5288
Location: ln -s /London ~
Reply with quote
Fogmeister wrote:
I missed 18!

That's (almost) my level of error! (8-p)

_________________
timark_uk wrote:
Gay sex is better than no sex

timark_uk wrote:
Edward Armitage is Awesome. Yes, that's right. Awesome with a A.


Thu Mar 25, 2010 3:31 pm
Profile
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 4876
Location: Newcastle
Reply with quote
I have NEARLY got Ackermann done :D

Only real problem is its VERY slow as instead of using recursion it uses the stack

Might use a stopwatch for it actually to see just how long it takes!

_________________
Twitter
Charlie 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 4:08 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
finlay666 wrote:
I have NEARLY got Ackermann done :D

Only real problem is its VERY slow as instead of using recursion it uses the stack

Might use a stopwatch for it actually to see just how long it takes!
Nice one!

Could you explain how you did it if you ever get it done?

I can't understand how to do it without using recursion.

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Thu Mar 25, 2010 4:24 pm
Profile WWW
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 4876
Location: Newcastle
Reply with quote
Fogmeister wrote:
Nice one!

Could you explain how you did it if you ever get it done?

I can't understand how to do it without using recursion.


using a stack, by pushing/popping values until you get to the end, call stack would get STUPIDLY high otherwise, as in over 200,000 recursive calls, c# in VS 2008 barfs with stack overflow at 9000 or so

I think C/Java are not suitable languages to solve it in due to the complexity and heavily recursive nature

Having seen how others do it it seems there is a nicer way to do it, as it converges after time
http://www.jstor.org/pss/2323780

_________________
Twitter
Charlie 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 4:44 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
Well... 14 has stumped me for now.

I've rewritten it several ways and I keep coming out with the exact same answer.

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Thu Mar 25, 2010 9:46 pm
Profile WWW
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 4876
Location: Newcastle
Reply with quote
Fogmeister wrote:
Well... 14 has stumped me for now.

I've rewritten it several ways and I keep coming out with the exact same answer.


You should use a BigInteger or similar, largest dataset you can really, thinking about doing it based on bit flags actually as I can have a 256bit number then...

EDIT: did it adapting the algorithm I had to start at 1 million and count down, and to use var instead of a set variable type, seemed to stop the number changing the -ve bit to set it to a huge negative number by mistake and it was pretty quick :D

_________________
Twitter
Charlie 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.


Last edited by finlay666 on Thu Mar 25, 2010 10:08 pm, edited 1 time in total.



Thu Mar 25, 2010 9:58 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
finlay666 wrote:
Fogmeister wrote:
Well... 14 has stumped me for now.

I've rewritten it several ways and I keep coming out with the exact same answer.


You should use a BigInteger or similar, largest dataset you can really, thinking about doing it based on bit flags actually as I can have a 256bit number then...

But with 14 the numbers aren't ever going to be big enough to warrant that are they?

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Thu Mar 25, 2010 10:05 pm
Profile WWW
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 4876
Location: Newcastle
Reply with quote
Fogmeister wrote:
finlay666 wrote:
Fogmeister wrote:
Well... 14 has stumped me for now.

I've rewritten it several ways and I keep coming out with the exact same answer.


You should use a BigInteger or similar, largest dataset you can really, thinking about doing it based on bit flags actually as I can have a 256bit number then...

But with 14 the numbers aren't ever going to be big enough to warrant that are they?


you would be surprised how big they get and how long the chains go on for (over 500 iterations)

_________________
Twitter
Charlie 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 10:09 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
finlay666 wrote:
you would be surprised how big they get and how long the chains go on for (over 500 iterations)

Well, that explains why my answer was wrong then :D

Reworking it now.

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Thu Mar 25, 2010 10:12 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
Done problem 10 now. Although I think my answer was too complex, I'm sure I'd be able to re do it a lot more simply.

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Tue Mar 30, 2010 8:34 pm
Profile WWW
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 4876
Location: Newcastle
Reply with quote
I'm stopping for a while because I have my exam on Thursday and apparently they are able to send the test this time :)

_________________
Twitter
Charlie 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.


Tue Mar 30, 2010 8:39 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
Well I've gone back today and had a look at a few more.

Some of them I thought were insanely impossible when I was looking at them previously but today I've rattled through several of them.

So far I've done...

1, 2, 5, 6, 7, 8, 9, 10, 17, 19, 22, 28, 42 and 79.

79 I was able to solve by hand in under a minute. :D

22 and 42 were very similar with only a couple of changes required.

19 was easy also as the code we use at work has a date data type with all the associated methods.

28 was also not too hard once I realised a pattern.

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Mon Aug 15, 2011 1:19 pm
Profile WWW
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 6:44 pm
Posts: 4141
Location: Exeter
Reply with quote
For some reason I've only just discovered this; will have a play with it this evening (don't fancy trying to do it in an Excel Macro ;) )

_________________
"The woman is a riddle inside a mystery wrapped in an enigma I've had sex with."


Mon Aug 15, 2011 2:48 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 113 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 8  Next

Who is online

Users browsing this forum: No registered users and 12 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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.