OCUK Xmas Programming Challenge

Any extra prizes for smallest source file/least amount of code?

And I take it we're free to use any libs available in the JDK?

Yep, basically as long as I can get it running without too much hassle on Linux/Windows it's all good :)

Smallest code can have some extra e-respect :p that's about all ill be able to offer :D
 
I'm planning to learn a new language in the coming weeks so I might submit a noob-tastic solution in that close to the end.

I hope someone using C# goes LINQ heavy!
 
Last edited:
Eurgh, trying to do stage 1, but I've got no idea why it says it's wrong :(.

Have stages 2, 3 and 4 working properly, they're just apparently getting the wrong number because of stage 1 :(.
 
Eurgh, trying to do stage 1, but I've got no idea why it says it's wrong :(.

Have stages 2, 3 and 4 working properly, they're just apparently getting the wrong number because of stage 1 :(.

I've just edited the first post - I made a small mistake with stage 1 sorry :(

Basically two values of n under 1.5 million produce the longest chain length. Go with the smaller of the two.
 
I've just edited the first post - I made a small mistake with stage 1 sorry :(

Basically two values of n under 1.5 million produce the longest chain length. Go with the smaller of the two.

Nah, that's not the problem, I only get 1 number that produces the longest chain length :confused:.

It's been a while since I did anything programming related, and I hadn't really been learning for very long either, so probably doing it completely wrong :p.

Edit - Worked it out :D.

Edit again - Got all done apart from stage 5 and stage 9, need to find out how to do prime number calcs now :p.
 
Last edited:
Edit again - Got all done apart from stage 5 and stage 9, need to find out how to do prime number calcs now :p.

Excellent, nice one :)

My Python proof-of-concept for the whole job takes 72 seconds on a 6 core 4ghz box, needs some serious optimization re-factoring :D especially as people have mentioned it should take significantly less time. Might have a go in ASM.
 
Hmm step 1 in Objective-C just using a simple loop is instantaneous.

Looked at it in OpenCL and yes it's possible (just use the normal ping-pong techniques for running the shader data for each step. Although without only 1.5M to calculate then a CPU doesn't have much of a problem.
 
My Python proof-of-concept for the whole job takes 72 seconds on a 6 core 4ghz box, needs some serious optimization re-factoring :D especially as people have mentioned it should take significantly less time.

Mine's in C++, the first one takes about 2 seconds, then the next 3 pop up at exactly the same time as the first. I can't really see how long the others will take that I've done as they require the missing parts to test properly.
 
Nine is interesting :D

2010-12-05 23:34:48.165 OcUK Xmas Programming Challenge[4587:a0f] start
2010-12-05 23:45:04.088 OcUK Xmas Programming Challenge[4587:a0f] complete

Ten minutes on a single thread (MBP, 2.4GHz C2D with 4GB 800MHz DDR2).. so just coding it up to split between the number of cores..
 
My coding skills are not great but just finished stage one. Took me way longer because of a stupid mistake.

Very fun challenge mind you had to put the thinking cap on big time.
 
Nine is interesting :D

2010-12-05 23:34:48.165 OcUK Xmas Programming Challenge[4587:a0f] start
2010-12-05 23:45:04.088 OcUK Xmas Programming Challenge[4587:a0f] complete

Ten minutes on a single thread (MBP, 2.4GHz C2D with 4GB 800MHz DDR2).. so just coding it up to split between the number of cores..

:eek:

Worked out number 9, that one calculates faster than stage 1, so for every stage other than 5 and 10 it takes a total of 2 seconds-ish.

That's using roughly 13% of my i7, I've got no idea how to make threaded apps, nor is there any real need to :p.

My coding skills are not great but just finished stage one. Took me way longer because of a stupid mistake.

Very fun challenge mind you had to put the thinking cap on big time.

You probably made the same mistake i did, took me ages to realise, as it's been ages since i programmed, and when i did i didn't know much anyways :p.
 
I was using the etherstones method as it's meant to be faster.. :/

Never heard of that :(. I don't know which method I'm using tbh, I know how it works and all that, but I don't know what it's called.

Done everything from 1 to 9 now, not sure how I'm going to solve 10 tho :confused:, will probably take me a while tomorrow.

Edit - Apparently 10 was easier than i thought, google found a variable type i didnt know about :D.
 
Last edited:
All done now :D.

Works out at 303 Lines of code with blank lines and quite a few comments, gonna work on making it better tomorrow i think, getting late now.

Takes approximatly 3 seconds to run, timed by checking windows clock, pressing enter on command line then checking clock before it's finished (anyone know how i can see how long it takes to run properly? :p).

I'll e-mail it to you once i've finished making it neater/more efficient etc :).
 
All done now :D.

Works out at 303 Lines of code with blank lines and quite a few comments, gonna work on making it better tomorrow i think, getting late now.

Takes approximatly 3 seconds to run, timed by checking windows clock, pressing enter on command line then checking clock before it's finished (anyone know how i can see how long it takes to run properly? :p).

I'll e-mail it to you once i've finished making it neater/more efficient etc :).

I've only quickly read the OP - but you generate primes upto 1.5 million in 3 secs? You using a SuperDome?
 
Back
Top Bottom