Question: how many valence electrons does nitrogen need to be stable?
Answer: Nitrogen has a total of 5 valence electrons, so doubling that, we would have a total of 10 valence electrons with two nitrogen atoms. The octet requires an atom to have 8 total electrons in order to have a full valence shell, therefore it needs to have a triple bond.