According to WikiPedia to correctly convert from RGB to CMYK or vice versa you need the ICC profile of the display devices involved. So RGB > CMYK is possible by knowing the ICC profile of the monitor being used and converting RGB to PCS and then the ICC profile of the printer/paper combo you're generating CMYK for to convert PCS to the printer specific CMYK. Stop me if I sound crazy ;-)
So my questions is where to find an algorithm that demonstrates taking RGB values and an ICC profile to create a PCS file and, secondly, where to find an algorithm for part II - the PCS > device specific CMYK if I have an ICC profile for the printer/paper and vice versa for CMYK to RGB.
The ultimate goal is a javascript tool to allow a designer to enter desired CMYK values in a web-based tool, see an approximation of the color in their browser and then generate a CMYK file to send to print.