Do we have a non-trival homomorphism $f$ such that $f\in Hom(\prod_{i=1}^{\infty} A_{i}, \mathbb{Q})$. Call $A_{n}={\mathbb{Z}}/{n\mathbb{Z}}$ , $n\ge 1$ and $n$ is integer. Do we have a non-trival ring homomorphism $f$ such that $f\in Hom(\prod_{i=1}^{\infty} A_{i}, \mathbb{Q})$?
 A: 
  
*
  
*There is no ring homomorphism $\prod_{n \ge 1} \mathbb{Z}/n\mathbb{Z} \to \mathbb{Q}$ 
  
*There is a non-zero group homomorphism $\prod_{n \ge 1} \mathbb{Z}/n\mathbb{Z} \to \mathbb{Q}$ 
  

Proof: $R := \prod_{n \ge 1} \mathbb{Z}/n\mathbb{Z}$. 
(1) By Lagrange's four-square theorem, each positive integer is the sum of four integer squares. Hence $-1 = n-1 \in \mathbb{Z}/n$ can be written as 
$$-1 = x_n^2 + y_n^2 + z_n^2 + w_n^2$$
with $x_n,...,w_n \in \mathbb{Z}/n$. By defining $x=(x_n)_{n\ge 1}$ and $y,z,w$ respectively, this equation is equivalent to 
$$-1_R = x^2 + y^2 + z^2 + w^2.\tag{$\ast$}$$
Suppose there is a ring hom. $R \to \mathbb{Q}$. Since ring homomorphisms preserve $-1$, $(\ast)$ implies that $-1\in \mathbb{Q}$ is a sum of rational squares which isn't true. 
(2) Fix a prime $p$. By projecting onto $p$-powers there is a surjective ring homomorphism $R \to \prod_{k \ge 1} \mathbb{Z}/p^k\mathbb{Z}$. By [1], the latter ring surjects onto the $p$-adic integers $\mathbb{Z}_p$. By composing with $\mathbb{Z}_p \hookrightarrow \mathbb{Q}_p$ we have a ring homomorphism $h: R \to \mathbb{Q}_p$. By considering $\mathbb{Q}_p$ as $\mathbb{Q}$-vector space, there is a $\mathbb{Q}$-linear projection $\mathbb{Q}_p \twoheadrightarrow \mathbb{Q}$. Composing with $h$ yields a group homomorphism $f: R \to \mathbb{Q}$. $f$ is non-zero because the restriction of $h$ and hence of $f$ to $\mathbb{Z}$ is the identity. q.e.d.
[1] https://mathoverflow.net/questions/199814/are-the-p-adics-a-direct-summand-of-the-direct-product-of-the-groups-mathbbz/199816#199816
