Reply to topic  [ 113 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 8  Next
Project Euler 
Author Message
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 4876
Location: Newcastle
Reply with quote
Really should get back into this myself...

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


Mon Aug 15, 2011 4:33 pm
Profile
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 6:44 pm
Posts: 4141
Location: Exeter
Reply with quote
Done 1 & 2, but they were rather trivial in Excel ;)

Currently in the process of teaching myself vb.net so having to learn the syntax as I go along for these.

Edit: Have worked out what I think is a logical way to go about doing number 3, now I just need to work out how to code it!

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


Mon Aug 15, 2011 6:44 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 number 4 now also.

Actually fairly an easy on. No arrays required or anything.

There is prob a quicker way of doing it but I basically had 2 loops with the inner loop getting smaller each time.

_________________
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


Wed Aug 17, 2011 2:50 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
Woop!

Just done number 11!

It seems it's fairly doable just by hand and would probably be quicker to do it by hand than it took me to code it! LOL!

(Although that's mainly due to my lack of familiarity with C++).

I'm sure there are built in functions to build 2d arrays and vectors but I had to build them by hand.

_________________
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


Wed Aug 17, 2011 8:31 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
OK, problem number 20 done!

I even had to write a recursive function to multiply a string by a number and it worked first time!

That's a fricking huuuuuuuuuuuuuuuuuuuuuuuge number!

BOOM! Problem 16 done also!

and now 30!

BOOM!

(I really should get some work done now)

I was struggling with 34 until I realised that 0! = 1 not 0.

ARGH! So frustrating!

_________________
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 Aug 18, 2011 9:26 am
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
OK, so now I've done...

1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17, 19, 20, 22, 28, 30, 34 and 79.

Only 5 more to go until I get onto lvl 1!

Been a real learning curve so far! The only one I wasn't happy with was 34 as it was a brute force attack that took a few minutes to complete.

I've actually just thought of a way to make it quicker. Should be considerably quicker also.

Hmm... how to implement...

_________________
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 Aug 18, 2011 11:30 am
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
Did 15 in Excel once I worked out how it works :D

Could program it but I'm at work.

Using the same method 18 and 67 will be done tonight :D However, as they are weighted paths I need to program them rather than do it in Excel :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


Fri Aug 19, 2011 8:33 am
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
Don't you just hate it when you write a program only to find out that the environment you are running in has a cripplingly low amount of memory.

Just written a solution for 58 but it won't even calculate the primes upto 10000.

Will have to copy paste into C++ and change the syntax.

:lol:

OK, that's a huge number. Need to find another way around this.

_________________
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


Fri Aug 19, 2011 10:09 am
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
WOOP!

I've reached level 1!

25 complete!

Read about Dijkstra's algorithm last night and worked out an implementation using the language I use at work.

Applied it to 18 and 67 and it solved 67 in about 0.7 seconds!

Very pleased! Beginning to get to grips with these algorithm thingies. Also thinking about how to apply them to other sorts of problems (especially shortest path stuff).

_________________
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


Fri Aug 19, 2011 3:48 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
Gah, 15 is doing my nut in. I'm convinced there is of course a forumula for an NxN grid, but I'm buggered if I can work it out.

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


Sat Aug 20, 2011 3:46 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
jonlumb wrote:
Gah, 15 is doing my nut in. I'm convinced there is of course a forumula for an NxN grid, but I'm buggered if I can work it out.

Let me know if you would like a subtle push in the right direction.

Took me a lot of scribbling to work it out. I went through several iterations of trying to work out formulas and stuff before realising what was needed.


---
I am here: http://maps.google.com/maps?ll=53.836762,-1.546622

_________________
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


Sat Aug 20, 2011 4:04 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
Ok, redone 1 and 2 in C++, rather chuffed as they both worked first time; not even a compiling error. Rather chuffed with this as I'm learning C++ as I go along.

That's all come crashing down with 3 though; I'm aware that the number is way too big to use int or long int, and things like the mod operation apparently cannot be used on floats or doubles. Not sure of a way round this...

Edit: disocovered long long int :oops:

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


Sun Aug 21, 2011 3:48 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
Nice one! I only did 3 after talking to you but spent a while trying to improve on it after writing it :-)

Even after I got the answer I did it a few more times to try and improve the speed.


---
I am here: http://maps.google.com/maps?ll=53.851236,-1.530917

_________________
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


Sun Aug 21, 2011 4:33 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
I'm just trying to work out if it's better to go for a brute force list of factors and to then try and factorise those to see if they're prime or build up a list of primes and check if any of them are a factor of the total.

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


Sun Aug 21, 2011 4:37 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
Blah blah ignore this :-)

_________________
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


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

Who is online

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