Code for integer partitioning