Lunar 500k recruitment challenge - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Python (https://sinister.ly/Forum-Python) +--- Thread: Lunar 500k recruitment challenge (/Thread-Lunar-500k-recruitment-challenge) Pages: 1 2 500k recruitment challenge - Inori - 03-12-2016 In honour of 500,000 posts, Serenity is holding a recruitment challenge. The challenge is to create a method that finds all primes under or equal to n. Constraints:total time for 1,000 tests under 2 seconds average time per test under 0.01 seconds get the correct number of primes (1,229 for our test case) same result as test method The following method dictates whether or not a submission passes: Code:```def benchmark(method):     """     Used for calculating a pass/fail in Serenity's     500k recruitment challenge     constraints:       - <5 seconds total runtime       - <0.01 seconds average runtime       - correct number of primes (1229 primes <= 10000)       - correct primes (compared to sample method)     """     time=__import__('timeit').timeit(         '%s(10000)'%method,         setup='from __main__ import '+method,         number=1000     )     res=eval(method+'(10000)')     pss=round(time,6)<5 and time/1000<0.01 and len(res)==1229 and test(10000)==res     return '\n'.join([         method+': '+('Fail','Pass')[pss]+         ('',' (distinction'+'+'*(time<0.0025)+')')[time<0.00324851038689],         'Average: '+`round(time/1000,6)`,         'Total:   '+`round(time,6)`,         'Score:   '+`(((0,3)[pss]+round(5-time,5))*(1,(1.25,1.5)[time<0.0025])[time<0.00324851038689])*10`     ])``` and the scores for my benchmark method: Code:```test: Pass Average: 0.003354 Total:   3.354264 Score:   46.4574``` Bonus points: The method I used is (one of) the most efficient for this task. Correct identification of who devised it and the name of it is +2 points Submission: PM me (on here or discord) with your entry to submit. If you'd prefer to do this challenge in another language, let me know, and I'll write something up. Recruitment: The top 50% of entries will be recruited to Serenity RE: 500k recruitment challenge - Rick - 03-27-2016 I like the idea of the thread but I don't see why you used such a high threshold, I mean very few people will be able to beat established prime counting algorithms. I could go and search for very efficient algorithms if I wanted and learn how they work but would that show my intellect? Wouldn't a better idea be to have no threshold and then judge off of the responses individually off of efficiency, creativity etc? RE: 500k recruitment challenge - Inori - 03-27-2016 (03-27-2016, 03:02 AM)Rick Wrote: I like the idea of the thread but I don't see why you used such a high threshold, I mean very few people will be able to beat established prime counting algorithms. I could go and search for very efficient algorithms if I wanted and learn how they work but would that show my intellect? Wouldn't a better idea be to have no threshold and then judge off of the responses individually off of efficiency, creativity etc? I'm not even considering the a "failed" program a fail. Passing is just a point bonus. RE: 500k recruitment challenge - lux - 03-27-2016 Uuuh, I made a Go Web api for calculating primes... Will write benchmarks. HTTP Endpoint: Server response for primes <= 1229 - 5ms Runtime Logic: Single instance benchmark - 1526696 ns/op Total time for 1000 ops - 1.7 RE: 500k recruitment challenge - insidious - 03-31-2016 Is there an ETA for when winners will be announced? RE: 500k recruitment challenge - Inori - 04-01-2016 (03-31-2016, 08:51 PM)insidious15 Wrote: Is there an ETA for when winners will be announced? No idea. I'm just waiting for more responses. RE: 500k recruitment challenge - m0dem - 04-01-2016 I need to get off my bum (...not literally...) and do this. Could we do a lookup into an internet API? (probably cheating...) RE: 500k recruitment challenge - Inori - 04-01-2016 (04-01-2016, 03:27 AM)m0dem Wrote: I need to get off my bum (...not literally...) and do this. Could we do a lookup into an internet API? (probably cheating...) you could, but an API call would probably take way longer than anything local RE: 500k recruitment challenge - m0dem - 04-02-2016 Aww... Finally, I got my prime function to work... Code:```sieve: Fail Average: 0.005121 Total:   5.12078 Score:   -1.2078``` I might try to make it better, somehow. RE: 500k recruitment challenge - Inori - 04-02-2016 (04-02-2016, 04:02 PM)m0dem Wrote: Aww... Finally, I got my prime function to work... Code:```sieve: Fail Average: 0.005121 Total:   5.12078 Score:   -1.2078``` I might try to make it better, somehow. Jesus, my scoring method needs work...