This problem appeared in the 1986 International Mathematics Olympiad: participants were asked to prove (or disprove) that the following algorithm always halts in a finite number of steps.
Initially, 5 real numbers are assigned to the vertices of a pentagon. Their sum is > 0. At each step, the algorithm
  - looks round the pentagon for a negative number. If it finds one, it
     - adds the number to its immediate neighbours, then changes its sign.
The algorithm halts when every number round the pentagon is ≥ 0.
The present PHP script works with integers (to maintain precision), and uses a simple formula for computing (from the initial numbers) the number of steps the algorithm will take. It displays this number before running the algorithm, then displays (in a table) the numbers round the pentagon as they change.
Assign 5 integers to the vertices of a pentagon. Note: their sum must be ≥ 1