When Microsoft founder Bill Gates took his software company public in 1986 as a 30-year-old — making him a millionaire and one of the richest men in the country — Facebook founder Mark Zuckerberg was just a toddler. Gates continued to run Microsoft, at one point the largest company in the world, until he stepped down as CEO in 2000.
During those years, a young Zuckerberg, who began hacking together chat networks as a pre-teen, was watching. Zuckerberg says seeing Gates succeed as a technology entrepreneur served as a powerful example for him.
"When I was growing up, Bill Gates was my hero," Zuckerberg said in 2013. "I think he is one of the greatest visionaries that our industry has ever had."
The biggest lesson Zuckerberg, now 34, took away from watching Gates, 62, was the power of focus.
"Growing up, I admired how Microsoft was mission-focused," Zuckerberg explained in a recent interview with Recode's Kara Swisher. "It was a company that had a clear social goal ... They thought that computers were gonna be valuable, and having that become ubiquitous."
When Gates founded Microsoft in 1975 with Paul Allen, computers were expensive and complicated. The first personal computer kit, the Altair 8800, had been released only a year earlier, and the Apple 1 computer wouldn't be released by Steve Jobs and Steve Wozniak until 1976.
But Gates had a vision of what personal computing could become.
"Paul Allen and I set the goal of a computer on every desk and in every home," Gates wrote in an email to Microsoft employees on the company's 40th anniversary. "It was a bold idea and a lot of people thought we were out of our minds to imagine it was possible."
Indeed, that vision came true. Recent estimates suggest there are over a billion computers running Windows software today.
For Zuckerberg, Gate's success at setting and achieving such an ambitious goal is admirable.
"There are companies that define themselves by a way of doing things ... and there are companies that define themselves by making a concrete change in the world. Microsoft did that," Zuckerberg says. "I have a huge amount of respect for [Gates] for doing that. He pushed them, and it was an incredibly inspiring company during the time that he was doing that."
Of course, Microsoft's singular focus also attracted criticism from competitors and lawmakers: Microsoft eventually held such a strong grip on the market for computer software that in 1998, the United States filed an anti-trust lawsuit against it to investigate if it held a monopoly (although the company ultimately wasn't broken up).
With 2 billion people using Facebook each month, the company has fielded questions from lawmakers on whether Zuckerberg's social network holds a monopoly (which he denies), along with other recent scrutiny.
In addition to leadership expertise, Zuckerberg says he has recently been looking to Gates for mentorship in philanthropy.
"I think his second act of going and being one of the world’s best philanthropists has absolutely influenced me," Zuckerberg tells Recode. "Not only to try to follow in his footsteps and do something, hopefully one day, that will be as impactful as what he has done, but his lesson there that you have to start early to practice.
"Like anything that you wanna get good at, you don’t just show up and effectively and efficiently give money away. The notion that if I wanna be really good at this 10 or 15 years from now, then Priscilla and I really need to be starting to work on this now," he continues.
In 2015, Zuckerberg and his wife Priscilla Chan pledged to give away 99 percent of their shares in Facebook to charity. Meanwhile, The Bill & Melinda Gates Foundation has given away billions since its founding in 2000.
"Bill Gates has always been a mentor and inspiration for me, even before I knew him," Zuckerberg says.
Like this story? Like CNBC Make It on Facebook.