Obama and Facebook in Warm Embrace

President Obama with a sweatshirt given to him by Mark Zuckerberg, the founder of Facebook, at a townhall meeting in Palo Alto, Calif., on Wednesday. Philip Scott Andrews/The New York Times President Obama with a sweatshirt given to him by Mark Zuckerberg, the founder of Facebook, at a townhall meeting in Palo Alto, Calif., on Wednesday.

PALO ALTO, Calif. — He introduced himself as “the guy who got Mark Zuckerberg to wear a jacket and tie.”

“I’m very proud of that,” President Obama quipped as he walked onto a stage at Facebook headquarters on Wednesday, and sat next to Mr. Zuckerberg. Both men then proceeded to take off their jackets. About an hour later, Mr. Obama, whose visit here forced Silicon Valley types to button down a bit, left with a far more casual item of clothing that has become de rigueur in some tech circles: a hoodie given to him by Mr. Zuckerberg. Of course, the Facebook logo was printed on it.

In the interim, Mr. Obama conducted a town-hall-style meeting at Facebook, and on Facebook, in front of a largely friendly audience. He took questions from company employees in a cavernous room turned into auditorium and from Facebook users over the social networking service, with Mr. Zuckerberg acting as moderator.

Mr. Obama delivered sharp attacks against Paul Ryan, the Republican congressman from Wisconsin who drafted a budget proposal heavy on spending cuts and tax cuts, and talked about the economy, health care, education and immigration reform.

Throughout the largely staged event, Mr. Obama and Mr. Zuckerberg appeared almost chummy with each other.

At one point, Mr. Zuckerberg praised Mr. Obama for his work on education. “I think 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,” Mr. Zuckerberg said.

Mr. Obama returned the favor a few minutes later, praising Mr. Zuckerberg for his $100 million philanthropic gift to public schools in Newark, New Jersey. “Mark, the work you’re doing in Newark, for example, the work that the Gates Foundation are doing in philanthropic investments, in best practices and education — especially around math and science training — are going to be so important,” Mr. Obama said.

Mr. Obama hit on some of Silicon Valley’s favorite policy items, like the importance of math and science education and the need to make it possible for highly skilled immigrants to stay in the United States. ” If we’ve got smart people who want to come here and start businesses and are Ph.D.’s in math and science and computer science, why don’t we want them to stay?” Mr. Obama asked. The crowd answered with an ovation.

“I think about somebody like an Andy Grove of Intel,” Mr. Obama continued. Mr. Grove, an immigrant from Hungary, is the former chief executive of Intel. “We want more Andy Groves here in the United States. We don’t want them starting companies — we don’t want them starting Intel in China or starting it in France. We want them starting it here.”

The audience was mostly Facebook employees with guests from the Valley’s technology and political establishment, including Democratic Representatives Nancy Pelosi, Mike Honda and John Garamendi; the investors Ron Conway and Mitch Kapor; and the entrepreneurs Tim O’Reilly and Kim Polese, among others.

After the event, Valerie Jarrett, a senior adviser to Mr. Obama, and Sheryl Sandberg, the chief operating officer of Facebook and who also served in the Clinton administration, conducted a panel on women in technology.

The increasingly close relationship between Facebook and Washington worries some privacy advocates who fear it will allow the social networking company to escape government scrutiny. But Facebook, like Google before it, appears to have become irresistible to politicians who see it as a way to connect with young, tech-savvy audiences.

For all the chumminess between the two men, Mr. Obama’s influence on Mr. Zuckerberg appears limited, at least when it comes to sartorial matters. Sure, Mr. Zuckerberg donned a jacket (briefly) and wore a tie. But he left his shirt collar open, and wore jeans and running shoes.

A full transcript of the meeting is available here.