There are various (Dis)Similarity measures.
(A) You have given Dot Product , which is very common.
$S=\Sigma a_ib_i$
(B) Commenter Malady has indicated Vector Norm , though there are variations there.
Commonly , we have $S=\Sigma (a_i-b_i)^2$ to measure (& then compare) Similarity.
We can have $S=\Sigma |a_i-b_i|$ manhattan measure
The Power $2$ can change to higher values (or lower values)
We could convert all these to the range $(0,1)$ or $(-1,+1)$ suitably
(C) In Current Scenario , a common alternative is the Edit Distance to check Integer/text Sequences.
Eg given $a$ & $b$ , how many operations (minimum) will convert $a$ to $b$ is the Edit Distance.
Small Edit Distance (ED) indicates Similarity , large ED indicates DisSimilarity.
ED itself has variations like Levenshtein Distance & Hamming Distance & Jaro–Winkler Distance.
You can check which suits you the most , though all are good enough given the Description you have given.
Here is my Illustrative Example , which might use arbitrary rules , not necessarily matching the Edit Distance Variations listed :
$a=(1,2,3,4,5,6)$ & $b=(2,1,3,4,5,6)$ & $c=(1,2,4,3,6,5)$
Here , we can convert $a$ to $b$ when we exchange $2$ & $3$ : $ED = 1$
We can convert $a$ to $c$ with 2 exchanges $(3 \leftrightarrow 4,5 \leftrightarrow 6)$ : $ED = 2$
We can convert $b$ to $c$ with 3 exchanges : $ED = 3$
(D) There are some measures which use "Binary Operations" involving Binary Vectors , though those are essentially simplifications/variations/generalizations of Vector Norms.
(E) In Case the Edit Distance not considering the actual Integers/Characters is a concern , you can tweak it like this :
When-ever some Edit occurs , we generally increment the Edit Distance. You want to take the Integer values into account , hence the Increment should have a scale/weight like $|a_1-b_2|$ , $a_1b_2$ , $1+|a_1-b_2|$ , $a_1b_2+1$ , etc. Choose the Increment which makes sense in your Scenario.
With that , even when regular ED values between two Pairs $a,b$ & $a,c$ are Equal , your tweaked ED values might change due to the scale/weight , indicating the actual "Chemicals" getting exchanged.