Ricci scalar curvature in FLRW flat universe I have a simple question about the relation between the Ricci scalar curvature and the $k$ constant in the Friedmann–Lemaître–Robertson–Walker solution. Assuming $k=0$, such that the space can be considered flat, the metric has the form (in natural units):
$$
ds^2=-dt^2+a^2(t)\left(dx^2+dy^2+dz^2\right).
$$
After some algebra I found the Ricci tensor $$R_{00}=-\frac{3\ddot{a}}{a}$$ $$R_{ij}=a^2\delta_{ij}\left[2\frac{\dot{a}^2}{a^2}+\frac{\ddot{a}}{a} \right]$$ and the term $R_{0i}=0$. Then I evaluated the Ricci scalar, finding $$R=6\left[\frac{\ddot{a}}{a}+\frac{\dot{a^2}}{a^2}\right].$$
So my question is: How can I have a flat spacetime if the Ricci scalar curvature is non zero? Moreover, which is the relation between the $k$ and the $R$ scalar?
 A: $k$ is not a measure of the curvature of spacetime, but rather of the spatial sections. $k = 0$ doesn't mean that spacetime is flat (your example isn't: since $a(t) \neq a_0$, it can't be Minkowski spacetime), but rather that the spatial sections are just the Euclidean $\mathbb{R}^3$ space rather than, for example, a $3$-sphere.
It is also possible to get it the other way around: for $R = 0$, one can get a FLRW solution with $k \neq 0$. The Milne model is such an example (it is just the future light-cone of the origin in Minkowski spacetime).
As one can see from explicit computation for the general $k$ FLRW metric (or by looking up on Wikipedia, as I'm doing right now), the full expression for $R$ including the contribution from $k$ is
$$R = 6 \left(\frac{\ddot{a}}{a} + \frac{\dot{a}^2}{a^2} + \frac{k}{a^2}\right).$$
You can, though, compute the Ricci scalar for the spatial section. Using the metric
$$\text{d}s^2 = - \text{d}t^2 + a(t)^2 \left(\frac{\text{d}r^2}{1 - k r^2} + r^2 \text{d}\Omega^2\right),$$
which has spatial metric
$$\text{d}l^2 = \frac{a(t)^2 \text{d}r^2}{1 - k r^2} + a(t)^2 r^2 \text{d}\Omega^2,$$
I got (with the aid of the Mathematica package OGRE) the expression
$${}^{(3)}R = \frac{6k}{a^2(t)}.$$
Hence, you can understand $k$ as being proportional to the Ricci scalar of the spatial section.
