Simple math algorithms