Reply to topic  [ 113 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8  Next
Project Euler 
Author Message
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, if anyone is still bothering with PE then add me as a friend...

My friend key is 77645475138828_559c6b95618a95bce6341cffa7532d82

_________________
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 Oct 25, 2011 12:47 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Jun 18, 2009 5:10 pm
Posts: 5836
Reply with quote
Added

I'm 89260527259205_c44a4f6a46d0cb1b56336558f861b57a

_________________
Jim

Image


Tue Oct 25, 2011 5: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
Problem 29 - I gave up and brute forced it in the end.

_________________
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 Oct 26, 2011 12:16 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
Added too

Mine is
72741547138783_cbda3d0aecb9219d73172fd9ddb124c5

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


Wed Oct 26, 2011 11:40 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
Brute forced 37 in under 2 seconds.

It was an optimised brute force though. Put trivial checks before any other checks (like checking for primes etc...)

_________________
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 Oct 27, 2011 11:21 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
Tried to use my code for 39 to solve 75...

It ran for 15 hours... and gave me the wrong answer.

:cry:

_________________
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 Oct 28, 2011 8:01 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
Why is it that you can look at a problem for ages and not know where to start then leave it for months and come back and do it first time in 5 mins.

Just did problem 35 :D

Runs VERY quickly (not sure how long exactly though, I'd guess less than 0.1 seconds).

_________________
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 Dec 19, 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
Boom!

107 and then following it very quickly using a very similar algorithm 31.

I was very pleased with 107 as it was all my own work and I didn't research the algorithm's before hand. Both run in around 15 ms.

_________________
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 Dec 20, 2011 3:30 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 87.

Runs in 0.18 seconds.

3 more to go until level 2!

_________________
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 Dec 21, 2011 11:54 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
Problem 54 done (a bitch to wrote the program for).

It's the poker one. How many hands does player 1 win out of 1000 games in a text file.

Started writing it and then had to scrap it and start again.

Runs in 20ms :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


Wed Dec 21, 2011 3: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
Problem 149 done!

Find the maximum sum of adjacent numbers in a straight line (up, down, left, right and diagonally) from an array of 2000x2000 random numbers.

Very pleased as my algorithm solves it in 1.7 seconds using a very efficient algorithm too :D

1 more to go until lvl 2!

_________________
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 Dec 22, 2011 12: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
I had a go at 287...

I had a program that worked but I calculated it would take around 500 days to get the answer for N=24.

_________________
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 Dec 23, 2011 11:30 am
Profile WWW
Has a life

Joined: Tue Jan 17, 2012 11:41 am
Posts: 2
Reply with quote
I've just done the first one in Python.

First attempt:

def problem1Version1():
....total = 0
....for n in range(1000):
........if n%3==0:
............total+=n
........elif n%5==0:
............total+=n
....return total


The used List Comprehension using a trick I found ages ago:


def problem1Version2():
....return sum([(n%3==0 or n%5==0) and n or 0 for n in range(1000)])


There's something similar on the Euler forums, but it was doing it in a less tricky way using something I remember reading about, but had forgotten about until reading it on the Euler forums. So I took that and made a new version that take lists, so it works with lots of numbers not just two.


def problem1Version5(target=1000,multiples=[3,5]):
....return sum([n for n in range(target) if len([n for multiple in multiples if n%multiple==0])>0])


But had also earlier made a long-winded version to check whether the numbers were coming out correctly.

def problem1Version4(target=1000,multiples=[3,5]):
....total = 0
....for n in range(target):
........found = False
........for multiple in multiples:
.............found = found or n%multiple==0
........total+=found and n or 0
....return total

--------

Got to start somewhere !


Tue Jan 17, 2012 12: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
Nice one!

Quote:
Got to start somewhere !


Exactly.

The whole point of PE is to work through the problems and learn new techniques and tools as you go along. Both from researching different algorithms and from reading how other people have solved the same puzzles you have.

When I started out there was no way that I would have been able to solve some of the puzzles I have now solved. It seemed like it almost was impossible. Now I'm currently trying to wrestle with some really tough puzzles (287) but I can kind of see a good way to get into it and make it work.

_________________
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 Jan 17, 2012 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
Fogmeister wrote:
Right, I've been working on a Sudoku algorithm for problem 96.

I first wrote an algorithm to just fill in the obvious ones (i.e. if 8 different numbers appear in the same column, row or mini grid then the remaining number goes in the current slot).

That didn't do much but I kept it.

I then implemented a thing that looked at the numbers that could go into the current space. If any of the numbers can't go into another square in the mini grid then place it there.

This managed to solve about 10 or 11 out of the 50.

I've now implemented a system that checks an assumption of a number. i.e. this slot can take either 4 or 7. Check 4, does that work or does it break the grid? If it works then place 4 and repeat the first set of checks.

I've now got a program that solves 43 out of the 50 sudoku grids.

The remaining 7 all get broken by the assumption system because they get set so that they become unsolvable :(

It's good fun though :D

LOL! Just been reading through the thread.

Well, this post opened up a can of worms!

Due to problem 96 I am now almost finished developing this... http://www.sudokuwiki.org/Sudoku_Solver ... le_Devices

:lol:

It is getting very nice now but also getting to the bit that just requires little tid bits finishing off (i.e. annoying bits rather than proper coding).

Can't wait to finish it now though!

_________________
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 Jan 17, 2012 4:29 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 113 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8  Next

Who is online

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