This disrespects the lower bound if a > n
In[9]:= (* Lichtblau *)
Remove[indicesFromLowToHigh]
indicesFromLowToHigh[l_, h_, n_, var_] :=
Module[{vars = Array[var, n]}, Table[{var[j], 1, h - n + j - Sum[var[k], {k, j - 1}]}, {j, n}]]
In[12]:= indicesFromLowToHigh[8, 10, 5, x]
Out[12]= {{x[1], 1, 6}, {x[2], 1, 7 - x[1]}, {x[3], 1, 8 - x[1] - x[2]},
{x[4], 1, 9 - x[1] - x[2] - x[3]}, {x[5], 1, 10 - x[1] - x[2] - x[3] - x[4]}}
In[18]:= Select[
Flatten[Table[X[x1, x2, x3, x4, x5], {x1, 1, 6}, {x2, 1, 7 - x1}, {x3, 1, 8 - x1 - x2}, {x4, 1, 9 - x1 - x2 - x3},
{x5, 1, 10 - x1 - x2 - x3 - x4}]] /. X -> List, (Plus @@ # < 8 || Plus @@ # > 10) &]
Out[18]= {{1, 1, 1, 1, 1}, {1, 1, 1, 1, 2}, {1, 1, 1, 1, 3}, {1, 1, 1, 2, 1}, {1, 1, 1, 2, 2}, {1, 1, 1, 3, 1},
{1, 1, 2, 1, 1}, {1, 1, 2, 1, 2}, {1, 1, 2, 2, 1}, {1, 1, 3, 1, 1}, {1, 2, 1, 1, 1}, {1, 2, 1, 1, 2},
{1, 2, 1, 2, 1}, {1, 2, 2, 1, 1}, {1, 3, 1, 1, 1}, {2, 1, 1, 1, 1}, {2, 1, 1, 1, 2}, {2, 1, 1, 2, 1},
{2, 1, 2, 1, 1}, {2, 2, 1, 1, 1}, {3, 1, 1, 1, 1}}
but if they become deleted afterwards, it does fit
In[19]:= (* Lehtonen *)
lehto = With[{b = 10, n = 5, a = 8},
If[a < 0 || n < 0 || b < 1 || b < a, Print["You will get the empty set!"]];
If[a < n, Print["Your conditions run empty on lower boundary!"]];
Flatten[Permutations /@ (ConstantArray[1, n] + PadLeft[#, n] & /@
Flatten[IntegerPartitions[#, n] & /@ Range[Max[0, a - n], b - n], 1]), 1]
];
In[26]:= lichtb =
DeleteCases[
Flatten[Table[
If[8 <= Plus @@ {x1, x2, x3, x4, x5} <= 10, X[x1, x2, x3, x4, x5], Y[x1, x2, x3, x4, x5]],
{x1, 1, 6}, {x2, 1, 7 - x1}, {x3, 1, 8 - x1 - x2}, {x4, 1, 9 - x1 - x2 - x3},
{x5, 1, 10 - x1 - x2 - x3 - x4}]], _Y] /. X -> List;
In[28]:= Sort[lehto] == Sort[lichtb]
Out[28]= True
so one could call this subtle brute force.