Login Register




Lunar 500k recruitment challenge filter_list
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
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

[+] 1 user Likes Inori's post
Reply

RE: 500k recruitment challenge #2
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?

[+] 1 user Likes Rick's post
Reply

RE: 500k recruitment challenge #3
(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.
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

[+] 4 users Like Inori's post
Reply

RE: 500k recruitment challenge #4
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
(This post was last modified: 03-27-2016, 11:13 PM by lux.)

[+] 3 users Like lux's post
Reply

RE: 500k recruitment challenge #5
Is there an ETA for when winners will be announced?
[Image: pBD38Xq.png]
Email: insidious@protonmail.ch

[+] 1 user Likes insidious's post
Reply

RE: 500k recruitment challenge #6
(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.
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

[+] 2 users Like Inori's post
Reply

RE: 500k recruitment challenge #7
I need to get off my bum (...not literally...) and do this.

Could we do a lookup into an internet API?
(probably cheating...) xD
(This post was last modified: 04-01-2016, 03:35 AM by m0dem.)

[+] 1 user Likes m0dem's post
Reply

RE: 500k recruitment challenge #8
(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...) xD

you could, but an API call would probably take way longer than anything local
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

[+] 1 user Likes Inori's post
Reply

RE: 500k recruitment challenge #9
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.

[+] 1 user Likes m0dem's post
Reply

RE: 500k recruitment challenge #10
(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...
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

[+] 1 user Likes Inori's post
Reply






Users browsing this thread: 1 Guest(s)