How to formularize the number of combinations for a list of attributes, each with a list of possible values Introduction
I have a set of attributes and a set of possible values for each attribute. An algorithm searches and finds all possible patterns of attributes following a few basic rules.
Let's assume we have the attributes $A$, $B$, $C$, $D$ and $E$.
Each attribute has 5 possible values. An attribute-value is a pair of the name of an atribute and a value, like $(A = 1)$ or $(B = 6)$. $m$ is the number of attributes. $n_i$ is the number of values for attribute $i$. $N$ is the number of possible patterns.

example list of attributes and their possible values:


*

*$A$ with values $1, 2, 3, 4, 5$

*$B$ with values $6, 7, 8, 9, 10$

*$C$ with values $11, 12, 13, 14, 15$

*$D$ with values $16, 17, 18, 19, 20$

*$E$ with values $21, 22, 23, 24, 25$



rules for patterns:


*

*a pattern is the concatenation of attribute values 

*examples 


*

*$P = \{(A = 1), (B = 6), (C = 12)\}$

*$P = \{(D = 18)\}$

*$P = \{(E = 21), (D = 17)\}$


*a pattern a can only have one value for each attribute, that means it is not allowed to have the following pattern: $P = \{(A = 1), (A = 2)\}$, because it has two rules for attribute $A$

*since the last rule states, that each attribute can only occur once for a pattern, the longest possible patterns have $m$ attributes. In this example the longest patterns consist of 5 attributes (one attribute-value for each $A$, $B$, $C$, $D$ and $E$).

*a pattern can be empty $P = \{\}$

*the contents of a pattern are not commutative, so $P = \{(A = 1), (B = 6)\}$ and $P = \{(B = 6), (A = 1)\}$ are different patterns



Problem: find a formular to calculate the number of possible combinations
I have an algorithm that finds all possible patterns, beginning with the empty pattern $P = \{\}$. This algorithm counts the number of patterns for me. I used the algorithm on the explained example ($5$ attributes with $5$ possible values each). According to the algorithm $458026$ different patterns can be built. What I try to find, is a formular to calculate the number of possible patterns for a given example. In reality the number of attributes can vary and the number of values for each attribute, can be different, too. In this case it would be enough to find a formular for this specific example ($5$ attributes à $5$ possible values).

Psuedo-Code
The algorithm works like this: 


*

*attributes is the set of attributes $\{A, B, C, D, E\}$

*attributes[i].values is the list of possible values for attribute i, e.g. attributes[0].values returns $\{1, 2, 3, 4, 5\}$, since attribute A can have these values.

*the algorithm works recursive, that means it takes a pattern, extends this pattern and then calls itself with the extended pattern

*starting point is the empty pattern $P = \{\}$


I know this is not the place for code, but it might help to understand what I am trying to achieve.
code as a bulleted list


*

*begin function search(currentPattern)


*

*increment patternCounter

*for all attributes a that are not already in the currentPattern


*

*for all possible values of this attribute a


*

*extend currentPattern by attribute-value pair $(a = v)$

*call search(extendedPattern)




*end function



Summary
The algorithm calculates $458026$ patterns (maybe one more for the empty pattern) and I am trying to find a formular for the number of possible combinations of patterns.
 A: For your case of $5$ attributes with each attribute having $5$ possible values, we can do the following:
We first pick a number $i$, which is going to be the different number of rules of this specific pattern.
After picking $i$, we have ${5 \choose{i}}$ ways of picking the $i$ attributes we will consider.
After that, each attribute can have $5$ values. Since we have $i$ attributes, we have $5^i$ different attributions for the $i$ attributes.
After setting the values of the attributes, we have to order them. Since different orders give different patterns, we have to multiply by $i!$ which is the number of permutations of the $i$ patterns.
Since $i$ can go from $0$ to $5$ we can put this in a summation:
$$\sum_{i = 0}^{5} {5\choose{i}}\cdot5^i\cdot i!$$
After asking Wolfram to compute this, I got the same result as you, $458026$ patterns, taking into account the empty pattern.
This is easily generalizable for a different number of patterns with a different number of values, as long as all patterns have the same number of possible values. Otherwise, the formula you get isn't as clean.
If you have $A$ attributes and each one can get $V$ different values, the formula becomes
$$\sum_{i = 0}^{A} {A\choose{i}}\cdot V^i\cdot i!$$
