First, a disclaimer: There's no magic number! Your best pedaling rpm will vary depending on factors such as a hill's steepness, its length, your bike's gearing and how you're feeling.
Generally, you want to be in a gear that lets you keep a climbing cadence of at least 80 rpm. (Count how may times your right foot comes around in 30 seconds, then double it for revolutions per minute.) A cadence of 80+ helps balance the workload between your leg muscles and cardiovascular system.
When standing on a hill, here's a way to tell if you're climbing with an efficient cadence even without counting pedal strokes.
If you're bobbing, the gear is too low. It's letting you drive through the power stroke too quickly. Shift to the next higher gear (smaller rear cog) and this should put you into the right zone.
If you're working the bike side to side to maintain momentum, the gear is too high. Your leg muscles will quickly fatigue under the strain. Shift to a lower gear (larger rear cog).
Thanks to brake/shift levers, you can change gears while standing and not lose much momentum. Try to lighten pedal pressure just as you make the shift. This helps the derailleur move the chain quicker with less jerking or gnashing.