I've edited my question as I don't think I've explained it well. The subset_sum function that is linked as a duplicate seems to be when the list of numbers is random but would also work in my situation. However, it seems to be inefficient for large numbers like my function below. My questions is for a list of number that is always known based on the value of N.
If N is 10 the list of numbers would be 1 through 9 or range(1, N). The function should return all unique number combinations from 1 to 9 with a sum of 10. In this case my function below will solve this and return 9 however for large numbers it takes a very long time. It seems to me there should be a better way to solve this when the range of numbers is known than having to iterate through each possible combination. Maybe I'm wrong though.
import itertools
def counter(n):
count = 0
l = range(1, n)
for i in range(1, n):
for c in itertools.combinations(l, i):
if sum(c) == n:
count += 1
return count