Let $\textbf{u} = (u_x,u_y,u_z)^T$ such that $\left\lVert \textbf{u} \right\rVert = 1$, and $\textbf{n} = (0,0,1)^T$. I'm trying to work out a rotation matrix $R$ such that
$$ \textbf{n} = R \textbf{u} $$
Given that $$ R = I + \sin(\theta)K + (1-\cos(\theta))K^2 $$
Where $K$ is the skew matrix built upon the rotation axis $\textbf{k}$. I'd do something like the following:
I'd exploit $\cos(\theta) = \textbf{n} \cdot \textbf{u} = u_z$, from there I can work out $\theta$, later I'd define $\textbf{k} = \textbf{u} \times \textbf{v}$. I'll stick these two into the Rodrigues formula and I should get $R$.
Is this procedure correct?
Update:
Figured out that since $u_z = \cos(\theta)$ we have $\sin(\theta) = \sqrt{1-u_z^2}$ therefore the rotation matrix is
$$ R = I + \sqrt{1-u_z^2} K + (1-u_z)K^2 $$
Your method is good, but the only remark that there are infinitely many rotations that transform one vector $\mathbf{u}$ into other vector $\mathbf{n}$ (see also derive quaternion from rotation matrix, via eigenvector for discussion about relationship of axis and value for rotation angle).
Method of Stijn should provide more solutions.
The other simple solution is for example to rotate about axis $ \mathbf{r}= \mathbf{u}+\mathbf{n}$ by the angle $\pi$ ( draw a picture and you'll see what I mean). If you want now to use Rodrigues formula, the vector $ \mathbf{r}$ requires normalization to unit length, name normalized vector $\hat{ \mathbf r}$.
For this case rotation matrix has a particularly simple form $R=2\hat{ \mathbf r}\hat{ \mathbf r}^T-I$.
The other more general method is to use the equation $N=RU$.
Matrix $N$ can be simply identity matrix $I$ - the last its column is just $\mathbf{n}$ vector, and $U$ is composed from the columns $[ \mathbf{u}_\perp \ \ \mathbf{u}×\mathbf{u_\perp} \ \ \mathbf{u}]$,
where $\mathbf{u}_\perp$ is any unit length vector perpendicular to $\mathbf{u}$.
In this case $I=RU$ and consequently $R=U^{−1}$.
Notice that here you have some degree of freedom in the choice of $\mathbf{u_\perp}$, one of them it can be normalized $\mathbf{n}×\mathbf{u}$.