ANNANDALE-ON-HUDSON, N.Y. — As camps go, the Summer Program in Mathematical Problem Solving might sound like a recipe for misery: six hours of head-scratching math instruction each day and nights in a college dorm far from home.

But Mattie Williams, 13, who attends Middle School 343 in the Bronx, was happy to attend, giving up summer barbecues with her parents and afternoons in the park with her Chihuahua, Pepsi. She and 16 other adolescents are spending three weeks at Bard College here in a free, new camp for low-income students gifted in mathematics.

All are entering eighth grade at New York City public middle schools where at least 75 percent of the student body is eligible for free lunches. And all love math. At this camp, asking “What kind of math do you like, algebra or geometry?” is considered an appropriate icebreaker, and invoking the newly learned term “the multiplication principle” elicits whoops and high-fives.

In a Bard classroom one afternoon, it seemed for a moment that Arturo Portnoy had stumped everyone. Dr. Portnoy, a math professor visiting from the University of Puerto Rico, posed this question: “The length of a rectangle is increased by 10 percent and the width is decreased by 10 percent. What percentage of the old area is the new area?”