Suppose I have a set {A, B, C, D, E, F, G}, and I need to find the number of possible subsets with N number of elements where each subset can only content neighboring elements.
Example: Find possible subsets where each contains 3 elements.
A B C D E F G
| | | | | |
|____[1]____| | | | |
| | | | |
|____[2]____| | | |
| | | |
|____[3]____| | |
| | | |
|____[4]____| |
| |
|____[5]____|
Here I have 5 subsets possible: [{A,B,C}, {B, C, D}, {C, D, E}, {D, E, F}, {E, F, G}].
Another example: Find possible subsets where each contains 2 elements
A B C D E
| | | | |
|_[1]_| | | |
| | | |
|_[2]_| | |
| | |
|_[3]_| |
| |
|_[4]_|
Here I have 4 subsets possible: [{A, B}, {B, C}, {C, D}, {D, E}].
How can this be achieved mathematically?