Each body exerts gravitational force on every other. Newton's law of gravitation and second law give the acceleration of body i:
Integrated using the Velocity-Verlet (Störmer-Verlet) symplectic integrator, which conserves energy much better than Euler for orbital mechanics:
Actual planetary masses, orbital radii, and velocities are used. Kepler's third law T² ∝ a³ means outer planets move much slower — Neptune takes 165 Earth years to orbit.