------
## 最终结论
```python
def combination_sum(nums, target):
    # Initialize a dynamic programming array to store the number of combinations
    dp = [0] * (target + 1)
    dp[0] = 1  # There's one way to reach the target of 0 (by choosing nothing)

    # Iterate over each value from 1 to target
    for i in range(1, target + 1):
        # For each number in the array, update the dp array
        for num in nums:
            if i >= num:  # Ensure we do not go out of bounds
                dp[i] += dp[i - num]

    return dp[target]

# Example usage
nums = [1, 2, 3]
target = 4
print(combination_sum(nums, target))  # Output: 7
```

This code calculates the number of possible combinations that add up to a given target using a dynamic programming approach. It assumes all numbers in `nums` are positive and there are no duplicates.