OCUK Xmas Programming Challenge

Soldato
Joined
11 Sep 2007
Posts
5,740
Location
from the internet
Should part 9 take 15mins plus? I've sent mine going and its still not finished yet it works correctly with a lower limit but with 2.5million its still chugging away *I think as its taking a nice solid 25% of CPU time but only 1,736K of memory :confused:

PC spec Intel Q6600 @ 2.4Ghz with 4GB Ram.


Blackvault

It can be made to go a lot faster than that - think about how all composite (non-prime) numbers are made up from multiplying together two or more prime numbers.
 
Last edited:
Associate
Joined
15 Dec 2010
Posts
117
woohoo from 13 seconds down to ~1 bad boy second :cool: :D

Submitted.

Things I learned:
* .NET 4.0's Parrellisation
* LINQ

Brilliant stuff.. Looking forward to the next one.
 
Last edited:
Soldato
OP
Joined
7 Apr 2004
Posts
4,212
Ok thanks guys - comps all finished and is now over :)

A grand total of 19 submissions totalling just over 8500 lines of code!

Now I shall try and work out a winner, somehow... :)

Results + everybody's code will be up sometime tomorrow afternoon, hopefully not too long after 3-4pm.

Edit: afraid it will be about 7pm now as had to go out.
 
Last edited:
Soldato
OP
Joined
7 Apr 2004
Posts
4,212
Ok - The results are in - 19 Submissions :D A few people who developed solutions in this thread didn't submit :( e.g Nickk and Rjindael - maybe you could upload your code anyway somewhere when it's done.

So every submission was correct in that it matched the spec perfectly and performed correctly to given inputs. This made picking a winner very tricky...

I don't have access to my 980x at the moment as im away for xmas, but all code was executed on a quad core Q8400 with 2gb ram. Everything except C# code was evaluated on Linux 64bit and C# code under Windows 7 64bit. Even then I did some comparisons between running c# under linux/mono and windows and there was very little in it. All timings were averaged over 3 executions.

Language Summary:
Java - 1
PHP - 1
Python - 2
C - 5
C++ - 3
C# - 7

So as expected C/C++ were the fastest performers with Python and PHP being surprisingly slow, even with good code being used. Several people used threading, be it pthreads, boost or .NET, all were fine.

Here are individual stats and links to everyone's code:


Bloomfield - C++
View Code
Time: 2.172 seconds
Lines of Code: 303

Crowze - PHP
View Code
Time: 9.291 seconds
Lines of Code: 843

Lightnix - C
View Code
Time: 0.227 seconds
Lines of Code: 354

Matja - C
View Code
Time: 0.147 seconds
Lines of Code: 225

Grimbough - C
View Code
Time: 0.099 seconds
Lines of Code: 329

MrMark - C#
View Code
Time: 0.281 seconds
Lines of Code: 273

Nimble - C++ ** Winner **
View Code
Time: 0.049 seconds
Lines of Code: 977

oOYoDaOo - C#
View Code
Time: 0.438 seconds
Lines of Code: 504

PaulStat - Python
View Code
Time: 8.160 seconds
Lines of Code: 184

Peve - Java
View Code
Time: 1.074 seconds
Lines of Code: 338

Pho - C#
View Code
Time: 0.225 seconds
Lines of Code: 736

Phyre - C#
View Code
Time: 0.173 seconds
Lines of Code: 607

Rat Hat - C ** Second **
View Code
Time: 0.110 seconds
Lines of Code: 246

7e7en - Python
View Code
Time: 9.445 seconds
Lines of Code: 181

Seany84 - C#
View Code
Time: 2.1 Seconds
Lines of Code: 306

Swanser - C
View Code
Time: 0.174 seconds
Lines of Code: 416

Thrash - C#
View Code
Time: 1.2 seconds
Lines of Code: 491

Tillus - C++
View Code
Time: 0.800 seconds
Lines of Code: 523

Haircut (Jon) - C# (many files!)
View Code 1
View Code 2
View Code 3
View Code 4
View Code 5
View Code 6
View Code 7
View Code 8
Time: 0.625 seconds
Lines of Code: 537

Winner: Nimble :) - Very nice overall implementation with threading used very effectively. Although the code is slightly lengthy and verbose and some elements could have been trimmed down, it all works nicely and is easy to read and comprehend :) - Rat Hat & Grimborough very nearly had the edge here as their code was a bit more 'raw/lower level', but I could only pick one.

Runner Ups: Rat Hat, Grimborough, Lightnix, Phyre, Pho - honestly everyone's was very good with good algorithms and efficient implementations. It's very difficult to say one is better than the other! :(


Hope everyone enjoyed the competition and learnt some bits and bobs along the way :) (Now you can tear each others code apart :p)

Nimble - I'll drop you a mail so you can claim the epic prize fund :)
 
Last edited:
Back
Top Bottom