TITLE: How important are publications for undergrads?
QUESTION [15 upvotes]: I have heard vastly conflicting statements about whether undergrads applying for PhD programs should have published already, or what level of research will be expected of them. Looking at CVs of some of my school's professors, almost none of them seem to have publications from earlier than the 2nd half of their graduate studies, meaning they spent most of their time before getting their PhD without any publications or those that they had weren't worth listing, in their eyes.
Obviously, I'm going to try to get the best experience I can as an undergrad, and I hope that means getting published research, but in every area I've dipped my toe in, from probability to dynamical systems to complexity theory, the sheer amount of additional knowledge I'd need to understand even a upper-level graduate text seems intimidating.
When did you first publish, and what sort of research experience (if it's something other than publishing an article) should an undergraduate aiming for a PhD have?
Disclaimer: I'm an undergrad in CS, pretty average or maybe above average in my progress so far, and I'd like to make a career in researching some of the theoretical (and obviously math-heavy) parts of computer science, rather than software or interface.

REPLY [17 votes]: My advice (as a pure mathematician!) is that the best way to get going in research is to write mathematics, and rewrite it till you have got it clear to yourself. The composer Ravel once commented: "Do copy! If you have some originality, it will show itself. If not,  do not worry!"  In fact the originality may show itself at say the 5th rewrite, when the creaking wheels of the brain have been finally knocked into a little motion. 
I did an essay on set theory for a College prize, which helped in an exam question. As a PhD student, I most enjoyed working with a visiting researcher (Dick Swan) on notes of his lectures on sheaves. Much later, I stumbled on the area of groupoids by trying to write a new proof that the fundamental group of the circle was the integers, and writing and rewriting my proof made me see that the arguments should generalise to higher dimensions.  
Daniel Quillen was said to have written thousands of pages of notes as he tried to understand various areas, and put them in his own terms. 
The question of publication of what you have written is more problematic.