This paper presents a method for generating gaits for a one-legged articulated hopping robot. A static optimization procedure produces the initial joint velocities for the flight phase, using the principle of conservation of angular momentum and assuming (nearly) passive flight. Two novel objective functions for this static optimization enable one to choose different gaits by simply changing a few parameters. A dynamic optimization procedure yields a solution for the flight trajectory that minimizes control effort. The stance phase (when the foot is touching the ground) becomes a standard two point boundary value problem, also solved with a dynamic optimization procedure. During the stance phase, the physical joint limitations, ground reaction forces, and the trajectory of the zero-moment point all constrain the solution. After these single-phase optimizations, a complete-cycle optimization procedure, incorporating both flight and stance phases, further reduces the control effort and balances the motion phases. In simulation, the leg hops on even ground and up stairs, exhibiting energy-efficient and intuitively satisfying gaits.