How to reach $n$th place from starting point using a 6 faced dice. I just completed some coding competition, and I was asked to solves this:

Imagine you are playing a board game. You roll a $6$-faced dice and move forward the same number of spaces that you rolled. If the finishing point is $n$ spaces away from the starting point, please implement a program that calculates how many possible ways there are to arrive exactly at the finishing point.

Can anyone explain how to solve this with a mathematical algorithm?
 A: Denote by $H(m)$ the number of histories $$(x_1,x_2,\ldots, x_r),\qquad x_i\in[6]\quad (1\leq i\leq r)$$ of arbitrary length $r\geq1$ that sum up to $m$, i.e., $\sum_{i=1}^r x_i=m$.  Then 
$$H(m)=0\quad(m<0),\quad H(0)=1$$
and
$$H(m)=\sum_{k=1}^6 H(m-k)\qquad(m\geq1)\ .$$
A: After a lot of calculation I found a solution that it creates a Hexanacci series. Now let me explain Hexanacci series a little bit. In the Hexanacci series each element is the summation of previous 6 elements. So I achieved this in Objective-C which can be easily convert to any language:
-(void)getHaxanassiSeriesOf:(NSInteger)number
 {
  static unsigned long ways;

  unsigned long first = 0;
  unsigned long second = 0;
  unsigned long third = 0;
  unsigned long fourth = 0;
  unsigned long fifth = 0;
  unsigned long sixth = 1;

  for (int i = 0; i<= number; i++) {

    ways = first + second + third + fourth + fifth + sixth;

    if (i>0) {
        first = second;
        second = third;
        third = fourth;
        fourth = fifth;
        fifth = sixth;
        sixth = ways;
    }

    NSLog(@"%d : -> %ld",i,ways);
}
return ways;}

// Result:
[self getHaxanassiSeriesOf:20];

0 : -> 1
1 : -> 1
2 : -> 2
3 : -> 4
4 : -> 8
5 : -> 16
6 : -> 32
7 : -> 63
8 : -> 125
9 : -> 248
10 : -> 492
11 : -> 976
12 : -> 1936
13 : -> 3840
14 : -> 7617
15 : -> 15109
16 : -> 29970
17 : -> 59448
18 : -> 117920
19 : -> 233904
20 : -> 463968

