Bertrand theorem permits closed orbits in 3d Euclidean space only for 2 types of central potentials. These are of Kepler-Coulomb and harmonic oscillator type. Volker Perlick recently extended Bertrand theorem. He designed new static spherically symmetric (Bertrand) spacetimes obeying Einstein's equations and supporting closed orbits. In this work we demonstrate that the topology and geometry of these spacetimes permits us to solve quantum many-body problem for any atom of periodic system exactly. The computations of spectrum for any atom are analogous to that for hydrogen atom. Initially, the exact solution of the Schrödinger equation for any multielectron atom (without reference to Bertrand theorem) was obtained by Tietz in 1956. We recalculated Tietz results by applying the methodology consistent with new (different from that developed by Fock in 1936) way of solving Schrödinger's equation for hydrogen atom. By using this new methodology it had become possible to demonstrate that the Tietz-type Schrödinger's equation is in fact describing the quantum motion in Bertrand spacetimes. As a bonus, we solved analytically the Löwdin's challenge problem. Obtained solution is not universal though since there are exceptions of the Madelung rule in transition metals and among lanthanides and actinides. Quantum mechanically these exceptions as well as the rule itself are treated thus far with help of relativistic Hartree-Fock calculations. The obtained results do not describe the exceptions in detail yet. However, studies outlined in this paper indicate that developed new methods are capable of describing exceptions as well. The paper ends with some remarks about usefulness of problems of atomic physics for development of quantum mechanics, quantum field theory and (teleparallel) gravity