Are genotypes with the same two alleles equivalent even if the alleles come from different parents?
If you have genomic imprinting then $k^n=m^2$ (with k=m and n=2 because of diploidy) is correct as inheriting a from the father and b from the mother (i.e. ab) is not equivalent to inheriting b from the father and a from the mother (i.e. ba). For 3 alleles (a,b,c) you have 9 possible genotypes (aa,ab,ac,ba,bb,bc,ca,cb,cc).

Under no genomic imprinting, ab and ba are equivalent. This is equivalent of calculating the number of elements of a triangular matrix which is $\frac{(m+1)*m}{2}$. So for m=3, you have 6 possible genotypes (aa,ab,ac,bb,bc,cc), for m=4 you have 10 possibilities (aa,ab,ac,ad,bb,bc,bd,cc,cd,dd) etc...

I hope this helps. Your formula is actually equivalent.