You either needed a reference pitch to calculate all other notes or you need to have all the pitches defined. Every formula to obtain a pitch needs a reference pitch and you need to know how that pitch relates to the one you are calculating.
The pitch you are using is relative to a system whether it is equal temperament, just, Pythagoras, ect. The pitches you build off each Not even every A4 is 440 Hz. There are a lot of different groups that use other frequencies like 435 or 441.
As long as you have a way to figure out which of the 12 notes you are dealing with (if you are using equal temperament like you seem to be) the rest is easy. You must have some method to know the difference between an A, A#, B, C, ect.
After you figure out the 12 base reference pitches of each note the calculations are simple as you only need to calculate one octave then double the frequencies to get an octave up and half to get an octave down which is valid regardless of system. For example, A3 which is an octave below A4 would map to the pitch 220 Hz and A5 which is an octave above A4 would map to 880 Hz.