Finding the ciliary beating pattern with optimal efficiency