integer algorithm