If you have a block with mass $m$ on a spring with spring constant $k$, the period and frequency of its oscillation are $$T=2\pi\sqrt{m\over k} \qquad f=\frac1{2\pi}\sqrt{k\over m}$$
If you are given $k$ and $m$, it's easy to calculate these. If you are given the period or frequency, however, you can solve for $k$ or $m$ by first squaring both sides, getting $$T^2=4\pi^2{m\over k} \qquad f^2=\frac1{4\pi^2}{k\over m}$$ and then solving for the desired variable.
For a pendulum, the formulae are very similar, although we use the constant $g=9.8{\rm m/s^2}$. $$T=2\pi\sqrt{L\over g} \qquad f=\frac1{2\pi}\sqrt{g\over L}$$ $$T^2=4\pi^2{L\over g} \qquad f^2=\frac1{4\pi^2}{g\over L}$$