We study here the ring QS n of Quasi-symmetric functions in the variables x 1, x 2,…, x n . Bergeron and Reutenauer (personal communication) formulated a number of conjectures about this ring; in particular, they conjectured that it is free over the ring Λ n of symmetric functions in x 1, x 2,…, x n . We present here an algorithm that recursively constructs a Λ n -module basis for QS n thereby proving one of the Bergeron–Reutenauer conjectures. This result also implies that the quotient of QS n by the ideal generated by the elementary symmetric functions has dimension n!. Surprisingly, to show the validity of our algorithm we were led to a truly remarkable connection between QS n and the harmonics of S n .