It is definitely interesting to see the different factorizations of p^n and how they correspond to the number of abelian groups of order p^n. This exercise highlights the importance of understanding the structure of prime numbers and their powers.
To answer your question about finding a formula for this relation, there is actually a well-known formula called the partition function that can help with this. The partition function, denoted as p(n), gives the number of ways to write a positive integer n as a sum of positive integers, disregarding the order of the summands. In other words, it counts the number of partitions of n.
For example, p(5) = 7, which is the number of ways to write 5 as a sum of positive integers: 5, 4+1, 3+2, 3+1+1, 2+2+1, 2+1+1+1, 1+1+1+1+1. This corresponds to the 7 different factorizations of p^5 that you mentioned.
In general, for a prime number p, the number of abelian groups of order p^n, up to isomorphism, is given by p(n), where n is the power of p. So for p=2, the number of abelian groups would be 1,2,4,7,11,16, etc. This relation is also known as the number of partitions of n with distinct parts.
While there may not be a simple formula for this relation, the partition function can help us understand the patterns and relationships between different factorizations of p^n. I hope this helps in your exploration of this interesting topic!