Babylonian Algorithm