Discrete math calculator