Find all real-valued functions on the positive integers such that $f(x + 1019) = f(x)$ for all $x$, and $f(xy) = f(x) f(y)$ for all $x,y$.
1. **Periodic Property**: Given the periodic property \( f(x + 1019) = f(x) \) for all \( x \), we know that \( f \) is periodic with period 1019. This implies that the function \( f \) is completely determined by its values on the set \( \{1, 2, \ldots, 1019\} \).

2. **Multiplicative Property**: Given the multiplicative property \( f(xy) = f(x) f(y) \) for all \( x, y \), we need to find a function that satisfies both this property and the periodic property.

3. **Primitive Root**: Since 1019 is a prime number, there exists a primitive root \( \zeta \) modulo 1019. A primitive root modulo 1019 is an integer \( \zeta \) such that its powers generate all the integers from 1 to 1018 modulo 1019. 

4. **Defining \( f \) on Primitive Root Powers**: Define \( f(\zeta) \) arbitrarily. Since \( \zeta \) is a primitive root, any integer \( x \) coprime to 1019 can be written as \( \zeta^k \mod 1019 \) for some integer \( k \). Therefore, \( f(\zeta^k) = f(\zeta)^k \).

5. **Residue Classes**: Since \( f(x + 1019) = f(x) \), the value of \( f \) depends only on the residue of \( x \mod 1019 \). Thus, we only need to define \( f \) on the set \( \{1, 2, \ldots, 1019\} \).

6. **Values of \( f \)**: 
   - For \( f(\zeta) \), we have \( f(\zeta^{1019}) = f(\zeta) \). Since \( \zeta^{1019} \equiv \zeta \mod 1019 \), it follows that \( f(\zeta) \) must be a real number.
   - The possible values for \( f(\zeta) \) are \( 0, 1, \) or \( -1 \) because \( f \) is real-valued and must satisfy the multiplicative property.

7. **Multiples of 1019**: For \( x \) being a multiple of 1019, say \( x = 1019k \), we have:
   - If \( f(\zeta) = 1 \), then \( f(1019k) \) can be defined as either 0 or 1, but it must be consistent for all multiples of 1019.
   - If \( f(\zeta) = 0 \) or \( f(\zeta) = -1 \), then \( f(1019k) \) must be 0 for all \( k \).

8. **Conclusion**: The function \( f \) can be defined as follows:
   - If \( f(\zeta) = 1 \), then \( f(x) = 1 \) for all \( x \) coprime to 1019, and \( f(x) = 0 \) for all \( x \) that are multiples of 1019.
   - If \( f(\zeta) = 0 \) or \( f(\zeta) = -1 \), then \( f(x) = 0 \) for all \( x \).

The final answer is \( \boxed{ f(x) = 1 } \) for all \( x \) coprime to 1019 and \( f(x) = 0 \) for all \( x \) that are multiples of 1019, or \( f(x) = 0 \) for all \( x \).