The native state structures of globular proteins are stable and well-packed indicating that self-interactions are favored over protein-solvent interactions under folding conditions. We use this as a guiding principle to derive the geometry of the building blocks of protein structures, alpha-helices and strands assembled into beta-sheets, with no adjustable parameters, no amino acid sequence information, and no chemistry. There is an almost perfect fit between the dictates of mathematics and physics and the rules of quantum chemistry. Our theory establishes an energy landscape that channels protein evolution by providing sequence-independent platforms for elaborating sequence-dependent functional diversity. Our work highlights the vital role of discreteness in life and has implications for the creation of artificial life and on the nature of life elsewhere in the cosmos.