MOUNTAIN VIEW, Calif. — At Google, data is king. Now the company is using data to figure out if it can anoint a few queens.

The company hopes its famous algorithms can solve one of the most vexing problems facing Silicon Valley: how to recruit and retain more women. Google has generally been considered a place where women have thrived, but it wants to figure out how to compete even more vigorously for the relatively few women working in technology.

Executives had been concerned that too many women dropped out in the interviewing process or were not promoted at the same rate as men, so they created algorithms to pinpoint exactly when the company lost women and to figure out how to keep them. Simple steps like making sure prospective hires meet other women during their interviews and extending maternity leaves seem to be producing results — at least among the rank and file.

Still, senior women at the company are losing ground. Since Larry Page became chief executive and reorganized Google last year, women have been pushed out of his inner circle and passed over for promotions. They include Marissa Mayer, who left last month to run Yahoo after being sidelined at Google.