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