We propose an algorithm to calculate the number of weak compositions, wherein each part is restricted to a different range of integers. This algorithm performs different orders of approximation up to the exact solution by using the Inclusion-Exclusion Principle. The great advantage of it with respect to the classical generating function technique is that the calculation is exponentially faster as the size of the numbers involved increases.
*Content Disclaimer Note (Added by Committee): This communication is a preprint uploaded under author responsibility. The Congress committee, only do a preliminary inspection of topic suitability. The content of this preprint communication is responsibility of authors and do not express the opinion of the members of committee. The committee is not responsible from content veracity or originality. Using automatic text generation tools, like ChatGPT, is allowed only for AI software/script coding purposes or as a way to improve quality of redaction of the original text. We recommend using text similarity analysis tools but this an author's decision.