chevron_left chevron_right
Login Register invert_colors photo_library

Stay updated and chat with others! - Join the Discord!
• 1 Vote(s) - 1 Average

 Lunar 500k recruitment challenge filter_list Linear Mode Threaded Mode View a Printable Version Author Message
500k recruitment challenge #1
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

1 user Likes Inori's post

 Messages In This Thread 500k recruitment challenge - by Inori - 03-12-2016, 11:32 PM RE: 500k recruitment challenge - by Rick - 03-27-2016, 03:02 AM RE: 500k recruitment challenge - by Inori - 03-27-2016, 06:50 PM RE: 500k recruitment challenge - by lux - 03-27-2016, 10:50 PM RE: 500k recruitment challenge - by insidious - 03-31-2016, 08:51 PM RE: 500k recruitment challenge - by Inori - 04-01-2016, 03:07 AM RE: 500k recruitment challenge - by m0dem - 04-01-2016, 03:27 AM RE: 500k recruitment challenge - by Inori - 04-01-2016, 11:50 AM RE: 500k recruitment challenge - by m0dem - 04-02-2016, 04:02 PM RE: 500k recruitment challenge - by Inori - 04-02-2016, 05:17 PM RE: 500k recruitment challenge - by m0dem - 04-02-2016, 05:48 PM RE: 500k recruitment challenge - by Inori - 04-02-2016, 07:58 PM RE: 500k recruitment challenge - by Inori - 04-04-2016, 07:59 PM RE: 500k recruitment challenge - by lux - 04-05-2016, 08:14 AM RE: 500k recruitment challenge - by Inori - 04-05-2016, 12:44 PM RE: 500k recruitment challenge - by lux - 04-05-2016, 02:33 PM

Users browsing this thread: 1 Guest(s)