Palo Alto, California (CNN) -- President Obama began his "town hall" event at Facebook's offices on Wednesday with an anecdote.
"I hate to tell stories about Mark," Obama said, referring to Facebook CEO Mark Zuckerberg, who was moderating the session.
As if the two former Harvard students were old friends, Obama then launched into a brief retelling of a dinner party he atttended in February with the 26-year-old computer whiz and about a dozen other tech-industry elites. There, Zuckerberg sat to the president's immediate right.
"I'm the guy who got Mark to wear a jacket and tie," Obama said, referring to Zuckerberg, who abandoned his usual T-shirt and hoodie ensemble that day. "Halfway through dinner, he's starting to sweat a bit. It's really uncomfortable for him. I helped him out of his jacket.
"In fact, if you want Mark, we can take our jackets off."
And so, like Obama has often done during less-formal speeches, the president on Wednesday removed his coat. Zuckerberg followed, revealing a dress shirt and black tie. (Though, he did wear sneakers.)
"Yeah, you're a lot better at this than me," Zuckerberg joked.
That kicked off a very cordial hour-long conversation and seemed to loosen up the sometimes chilly technology prodigy. Zuckerberg stumbled during his opening remarks. "Sorry, I'm kind of nervous," he said after a flub in his introduction.
For Obama, Wednesday was a chance to connect with both Silicon Valley influencers and young people in one poke. Throughout his answers, Obama related his typical talking points -- federal deficit, education, healthcare and immigration -- to those two groups.
To the technorati, Obama promoted education in math and sciences, highlighted the especially acute real-estate market in the affluent area here, and talked up immigration reform. "We don't want them starting Intel in China, or starting Intel in France. We want them here," he said.
To the youthful audience of Facebook employees, he provided advice and stirred his familiar call for change. "Historically, part of what makes for a healthy democracy, what is a good politics, is when you have citizens who are informed, who are engaged. And what Facebook allows us to do is make sure this isn't just a one-way conversation," Obama said.
For Facebook, the meeting was an opportunity to validate itself in the eyes of Washington, where it's ramped up lobbying efforts recently. That's important for most companies growing at the rate and size Facebook is.
Zuckerberg has already proven himself to 500 million people who use the service and to wealthy investors. The Facebook founder is worth $13.5 billion, according to data from Forbes.
That fact provided an opening for another ribbing from Obama, when discussing the president's proposal for ending tax cuts for the wealthy.
"People like me and you, Mark, (should be) paying a little more in taxes," Obama said. "I know you're OK with that."
Despite the president's plan to take more of Zuckerberg's money, the young billionaire praised Obama's efforts in education reform.
"I think that the Race to the Top stuff that you guys have done is one of the most under-appreciated and most important things that your administration has done," Zuckerberg told the president.
For his part, Zuckerberg announced in September that he would donate $100 million to Newark, New Jersey, public schools.
Obama has commended Facebook in past speeches, including in his State of the Union address in January. He placed Zuckerberg's creation in a pantheon of great American ingenuity success stories, beside the inventors of the light bulb and the airplane.
"We're the nation that put cars in driveways and computers in offices; the nation of Edison and the Wright brothers; of Google and Facebook," Obama said in that speech. "In America, innovation doesn't just change our lives. It is how we make our living."
Facebook indicated in statements leading up to Wednesday's event that this was not an endorsement for the president. Likewise, White House Press Secretary Jay Carney told reporters on the flight over here that the event was not meant to be a promotion for Facebook.
"This is not about endorsing a specific company," Carney said. "It's about accepting an invitation for a forum to speak to the American people."
People traveling on Air Force One watched "The Social Network," the controversial movie about the founding of Facebook, Carney said.
Facebook did, however, offer a gift to Obama at the end of the event. It was a sweatshirt with the website's logo stamped on the front -- "in case, for some reason, you want to dress like me," Zuckerberg said.