Return the first N primes With a twist; your algorithm has to be less complex than O(X2) where X is the Nth prime. Your solution post should include the character count and the theoretical complexity in terms of X (or N, which ~= X/ln(X) and so will usually be more efficient)

Here's a hint solution in C# (O(Xln(sqrt(X))), 137 chars):


   public List&lt;int&gt; P(int n){var r = new List&lt;int&gt;{2}; int i=3; while(r.Count&lt;n) if(!r.TakeWhile(x=&gt;x&lt;Math.Sqrt(i)).Any(x=&gt;i%x==0)) r.Add(i++); else i++; }
J, 4 characters
p:i.

Usage:
   p:i.10
2 3 5 7 11 13 17 19 23 29

The problem with using J here is that I don't really know how efficient it is. I'd assume that as a language specialising in &quot;mathematical, statistical, and logical analysis of data&quot;, that the algorithm used to generate the primes is pretty good.
I did look at the C source for clues, but it turns out that the C source for J is almost as unreadable as J itself. :-)
(The file is called v2.c for anyone who wants to have a look)