title: What is the shortest way to calculate the nth prime?
body: <p>What is the shortest <strong>C code</strong> to "<strong>Calculate the <em>n</em>-th prime</strong>"?</p>
  
  <p>Shortest in terms of <strong>significant characters</strong>, i.e. <em>the number of semicolons, non-whitespace characters, keywords and commas</em>.</p>
  
  <h2>Input:</h2>
  
  <p>Integers <em>n</em> from the standard input, separated by new lines. The input will be terminated by EOF.</p>
  
  <h2>Output:</h2>
  
  <p>Right after the input <em>n</em>, print the <em>n</em>-th prime to the standard output separated by new lines.</p>
  
  <p>(You may assume the prime numbers are &lt; 10,000, i.e. <em>n</em> &lt; 1,230.)</p>
  
  <hr>
  
  <h2>Test cases:</h2>
  
  <pre><code>Input:
      1
      2
      4
      8
      32
      999
      42
      5
  
  Output:
      2
      3
      7
      19
      131
      7907
      181
      11
  </code></pre>
  
  <hr>
  
  <p>My attempt :</p>
  
  <pre><code> #define m 10000
   a[m],b[m],x;
  
   main(i,j){
     for(i=2;i&lt;m;i++)
        {
         if (!a[i])
         for (b[++x]=i,j=2*i;j&lt;m;j+=i)
              a[j]=1;
        }
     for(;~scanf("%d",&amp;i);printf("%d\n",b[i]));
    }
  </code></pre>
  
  <p>For this problem readability is not a concern.A costlier code in terms of time and memory but satisfying the constraint will be considered better here.</p>