Algorithms and math