Let $p$ be prime where $p$ does not divide the order of the group G.
Consider these groups: $G\oplus Z_{p^4}; G\oplus Z_{p^3}\oplus Z_p; G\oplus Z_{p^2}\oplus Z_p\oplus Z_p; G\oplus Z_{p}\oplus Z_p\oplus Z_p\oplus Z_p$.
The question is count the number of element of order $p$ and what is the pattern.
This is what I have found:
For the first group, $G\oplus Z_{p^4}$, in order to find the order of the group its the $lcm(|a|,|b|)$ where $a \in G$ and $b \in Z_{p^4}$. So the only way to get something of order $p$ and $p$ is prime and does not divide the order of $G$, is with $(1,p)$. Thus number of elements of order $p$ will be $\phi(p)=p-1$ since $p$ is prime.
For the second group we have a similar idea. Only possible ways are with $(1,p,p), (1,p,1), (1,1,p)$. So Now we have $\phi(p)*\phi(p)$ for the first one, and then $\phi(p)$ for the last two. Thus in total we get $(p-1)^2+2(p-1)$.
For the third group, we now get $(1,p,p,p), (1,p,p,1), (1,p,1,p), (1,1,p,p), (1,p,1,1),(1,1,p,1), (1,1,1,p)$. Therefore we get $(p-1)^3+3(p-1)^2+3(p-1).$
For the final group, now have $(1,p,p,p,p)$, then 4 ways to show $(1,p,p,p,1)$ where the first 1 stays put, and 6 ways to show $(1,p,p,1,1)$ where first 1 stays put, and then 4 ways to show $(1,p,1,1,1)$. So in total we get $(p-1)^4+4(p-1)^3+6(p-1)^2+4(p-1)$ total elements of order $p$.
I think I am wrong when I say there are 6 ways to show $(1,p,p,1,1)$ because then my pattern gets thrown off. I then have to do it again with these groups, but find elements of order $p^2$.
$G\oplus Z_{p^6}; G\oplus Z_{p^4} \oplus Z_{p^2}; G\oplus Z_{p^2}\oplus Z_{p^2}\oplus Z_{p^2}$.
Now my question here is the totient function of $p^2$ simply $p^2-1$?
Hint: the order of an element $(a_1,a_2\dots a_n)$ in the direct product $G_1,G_2\dots G_n$ of finite $p$-groups is the maximum order of the $a_i$'s.
In this case use that and you get $(a_1,a_2\dots a_n)$ has order $p$ if and only if every $a_i$ has order $p$ or $1$ and $(a_1,a_2\dots a_n)\neq e$. So finding the elements of order $p$ amounts to finding the number of lists in which each element has order $p$ and then substract $1$
Thus if $C_i$ is the number of elements of order $p$ or $1$ in $G_i$ the number you are looking for is $(C_1C_2\dots C_n)-1$.
So now all you have to do is find how many elements have order $p$ or $1$ in $Z_{p^a}$.