Return the first N primes
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)