Here is an example of Python code that uses a recursive method to address this problem: def print_combinations ( n , combination = [ ] , start = 1 ) : if n < 0 : return elif n == 0 : print ( combination ) else : for i in range ( start , n + 1 ) : print_combinations ( n - i , combination + [ i ] , i ) print_combinations ( 4 ) This code defines the function print_combinations , which takes three arguments: the target number n , the current set of numbers, and the starting point for the next iteration. The function first checks if n is less than 0, returning immediately since a negative sum is not possible. If n is equal to 0, it indicates a valid combination has been found, and it is printed. If n remains greater than 0, the function loops from the starting number to n , making a recursive call to print_combinations with updated parameters.