some code about discrete maths