https://rosettacode.org/wiki/N-body_problem