These "number of ways" constitute the so-called Hexanacci numbers (https://oeis.org/A001592)
$$ 1, 2, 4, 8, 16, 32, 63, 125, 248, 492, 976, 1936, 3840, 7617, 15109, 29970, 59448, 117920,...$$
defined by recurrence relationship:
$$\tag{1}a_{n} = \sum_{k=1}^6 a_{n-k} \ \ \text{with} \ \ a_{-5}=a_{-4}=a_{-3}=a_{-2}=a_{-1}=0, \ \text{and} \ a_{0}=1.$$
NB: six artificial values have had to be introduced before the beginning of the "true" sequence with $a_1$.
let us consider now an example: let us take $n=4$; there are $a_4=8$ ways to obtain a total of 4:
$$\underbrace{(1111, 211, 121, 31)}_{a_3=4}, \underbrace{(112, 22)}_{a_2=2}, \underbrace{(13)}_{a_1=1}, \underbrace{(4)}_{a_0=1}.$$
(we have grouped them according to their last number, either 1,2,3,4, here).
The proof of (1) is easy, and can be understood as a generalization of example above.
The set $\frak{S}_n$ of sequences of numbers $\{1,2,\cdots 6\}$ whose sum is $n$ can be partitioned into at most 6 (non intersecting) classes $C_1, C_2, ... C_6$, this index being in correspondence with the last digit of the sequence. How such a sequence can be built ? By adding
1 to any of the $a_{n-1}$ sequences summing to $n-1$,
2 to any of the $a_{n-2}$ sequences summing to $n-2$,
...
- 6 to any of the $a_{n-6}$ sequences summing to $n-6$.
(some of these sets being hopefully void) [end of proof].
Recurrence (1) is a very efficient way to obtain these numbers.
It is rather easy to prove that sequence $a_n$ (shown in red on the figure) is equivalent to (and bounded from above by) sequence $2^{k-1}$, $k=1\cdots (n-1)$ (in blue), with coincidence for the first 6 terms.
Here is a Matlab program implementing these ideas, generating the sequence $b_n:=a_{n+6}$
n=1000;n1=n+6;
b=zeros(1,n1);
b(6)=1;
for k=7:n1
a(k)=sum(b(k-6:k-1));
end
b(n1)
For $n=1000$, one finds $b_{1006}=a_{1000}\approx 1.47 \times 10^{297}$ !
