Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Yeah, yeah, cheesy title. Couldn't think of anything better, so sue me...

Anyway, This is an obfuscation contest. i'm going to lay down some parameters (hopefully strict, clear, and concise as to input and output) and you (my lucky reader) are going to try to create the most obfuscated program you can that adheres to the specifications.

Rules:

  1. You are to receive a number on command line. The number will be positive (> 0) and less than 999,999 (due to constraints on my time).
  2. You will output a certain number of primes equal to the number submitted on command line. They will probably not be the smallest, but they must be in order and no duplicates.
  3. The algorithm:
    1. Let p be 3.
    2. Iterate over the expression x^2 + x + p such that 0 < x < p.
    3. For every number iterated over, check to see whether it is prime or not (using any algorithm). If it is add it to the list of primes found so far.
    4. Increment p to the next prime.
    5. Repeat from step 2 until the number of primes specified is found.
  4. When printing primes, print 2 first, then the rest.
  5. Printing more primes is not faultable, but not optimal. Printing more than twice the number specified will automatically discount your entry.
  6. All primes output must be \s delimited.
  7. All entries must be smaller than 4k of text.
  8. All entries must finish before the heat death of the universe.
  9. Strict and warnings are not necessary. No modules.
That should be specific enough. If there are any ambiguities please let me know. Please treat this roughly the same as a golf contest, with a different goal in mind. And as always, have fun :-)

jynx

Update: The "contest" will finish December 1st (of 2002) and <shameless plug> there will be a prize! </shameless plug>

Update2: i'm not going to give a prize when only 2 people entered submissions (sorry). i may by consolation prizes for them so that they don't feel gypped, but hopefully i'll get more turn-out next time... ;-)


In reply to Mission: Obfuscation (1) by jynx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (5)
    As of 2014-09-17 06:44 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (61 votes), past polls