The antikythera machine is commonly referred to as the “world’s oldest computer”. Dating back to around 150 B.C., the mechanism was discovered in a shipwreck around 1900, and it has amazed scientists and engineers with its precision craftsmanship. Recent x-ray analyses of the object helped bolster the conclusion that it was designed to predict eclipses, and probably was able to do so with remarkable accuracy.
This video shows the functioning lego replica and gives some of the mathematical background relevant to how the machine operates (apparently the ratio 5/19 is extremely important for calculating the cycles of ellipses) . Throughout the video, the machine is deconsrtucted and you can see the inner-workings of the various parts. Truly amazing.