I'm breaking my head to create a logic that does the following:
Get an array of N positions, within these positions define all possible possibilities without repeating the key of a position.
Example: Array ('A', 'B', 'C')
A
AB
ABC
B.C
ACB
B
BA
BAC
BC
BCA
W
HERE
CAB
CB
CBA
Examples of the mathematical formula
When there are 3 positions:
3+ (3 * 2) + (3 * 2 * 1)
When there are 4 positions:
4 + (4 * 3) + (4 * 3 * 2) + (4 * 3 * 2 * 1)