How do i compute the number of abelian groups? I have to make a program that computes the number of abelian group structures of type (G, *) where G = {a1, a2, ...., an}, and n is given as an input from the user(the problem is more than that but this is where i got stuck). Is there any formula for calculating this number, or do i have to compute every group, check if it is abelian and then count them? 
For clarification, i need the number of abelian structures, which are in this form for n=4: https://ibb.co/K2QWMNg
These are only the first 4 , there are 12 more, similar to these 4, but with different identity elements
 A: This is not going to be a trivial problem. Contrary to my original assertion, it is not simply $n!A(n)$ with $A(n)$ the number of nonisomorphic abelian groups.
Take the case $n=4$. To give a set of $4$ elements a cyclic group structure, we can select an arbitrary element to be the identity (four choices) and an arbitrary element to be the element of order $2$ (three remaining choices). Those two choices completely determine the multiplication table, so you have $12$ ways of assigning the cyclic-group-of-order-4 structure to the set, rather than the expected $4!=24$ you get; this, because exchanging a distinguished generator and its inverse will not change the multiplication table.
For the Klein $4$-group structure, once you determine the identity, this completely determines the multiplication table; every element is its own inverse, and the remaining two entries in each row and column are forced. This gives $4$ ways of giving it the Klein $4$-group structure.
By contrast, for $n=5$, you can pick the identity (5 possibilities); a generator (4 possibilities), its square (3 possiblities), and its cube (2 possibilities), arbitrarily. The remaining entries are forced. They will each give you a different table. So here you do get $5!$ possible ways of defining the multiplication.
The fact that this analysis is rather ad hoc suggests to me that it will be difficult to find a closed formula.
So I don't think there is an easy closed formula for it, even if you know $A(n)$ (which is related to the factorization of $n$ and the partition numbers for the exponents).
But you don't want a closed formula, you want a program to calculate the number. I don't know what the expected answer is; it is not hard to make a program to figure out how many latin squares there are, and you actually only need to fill out the top half of the square since abelianness means the multiplication table will necessarily be symmetric about the main diagonal. But checking associativity is not straightforward, so you may have to do that in some direct way. 
