Let u(n) and v(n) be the number of representations of a nonnegative integer n in the forms x2+4y2+4z2 and x2+2y2+2z2, respectively, with x,y,z∈ℤ, and let a4(n) and r3(n) be the number of 4-cores of n and the number of representations of n as a sum of three squares, respectively. By employing simple theta-function identities of Ramanujan, we prove that $u(8n+5)=8a_4(n)=v(8n+5)=\frac {1}{3}r_3(8n+5)$. With the help of this and a classical result of Gauss, we find a simple proof of a result on a4 (n) proved earlier by K. Ono and L. Sze [‘4-core partitions and class numbers’, Acta Arith. 80 (1997), 249–272]. We also find some new infinite families of arithmetic relations involving a4 (n) .