Perfect and Optimal Rulers

Generating and counting.

Thanks to Hugo Pfoertner and Rainer Rosenthal for for many helpful and encouraging comments.