The United States won the 22nd International Mathematical Olympiad, beating West Germany by two points and the United Kingdom by 13, it was announced yesterday.

It was the United States' second victory in the world's most prestigious math competition for high school students since it began participating in 1974. m

Four members of the eight-person U.S. team, including 15-year-old Brian R. Hunt of Silver Spring, achieved perfect scores in the exam, which tests problem-solving ability in complicated algebra and geometry. The exam was conducted in two 4 1/2-hour segments at Georgetown University Mondany and Tuesday, and the results were announced at ceremonies yesterday at the National Academy of Sciences.

Results are announced officially only for individual members of teams, with a maximum 42 points being awarded for a perfect score. However, team standings are compiled unofficially by adding all the scores. The United States had 314 points.

The Soviet Union has won the olympiad eight times since it began in the summer of 1959, but this year entered only six students instead of the allowable eight. In all, 192 students from 27 countries participated.

Many of the participants thought this year's exam was easy -- there were 24 perfect scores -- and Hunt said yesterday he was a "bit disappointed" that it wasn't more challenging.

But the Montgomery Blair High School student, who is also taking advanced courses at the University of Maryland, said he would try to get a place on the U.S. team next year, hoping the test will be harder.

Richard A. Stong, 17, of Charlottesville, who won a second prize, said he also found the test easy, adding that "on the second day most of the U.S. team left after two hours."

Stong, who left home on June 8 to join the U.S. team and practice with instructors and former participants in the competition, said he was eager to return the baseball strike until two weeks ago, and then by word of mouth," he said.

Blue book bags with International Mathematical Olympiad badges sewed on them were awarded to third-place finishers. Second-place finishers received digital watches, and first-place winners were given calculators, except for members of the U.S. team.

They had already won calculators in the U.S. runoffs, and so were given "memory modules" to attach to them instead.

Yesterday's ceremonies demonstrated that some of the contestants' talents extend well beyond math. Gregg Pratuno, a Staten Island student who won a second prize, began the ceremonies by playing Gershwin's "Rhapsody in Blue" on the piano. And 14-year-old Noam D. Elkies, a New Yorker who got a perfect score, concluded the ceremonies by playing a piano composition of his own and some Bach.

After the ceremonies, U.S. coach Murray S. Klamkin watched members of the team pose for photographs on the Einstei statue outside of the academy building and said, "They are good students, and they worked hard." Tough training and "basic good luck" also contributed to the success, said Klamkin, a mathematics professor who has just completed an appointment at the University of Alberta.

But the most important thing was that they met fellow mathematicians from other countries, people who may be their future colleagues, Klamkin said. "This is a friendly competition, not war," he said.

Students were divided into language groups during sightseeing trips, and got to know best those who spoke the same language. So when awards were handed out, teams from Spanish- and English-speaking countries received the loudest applause. But the biggest round of all went to Taneli Huuskonen of Finland, who marched onto the stage to receive his first prize waving a Finnish flag. It was the first time he had traveled outside Finland except for a brief trip to Sweden several years ago.

The trip to America was the best part about the competition, he said, and when the rest of the Finnish team leaves for home, he will go to Minneapolis to visit friends. "I'd enjoy it more if it wasn't so hot," he said. "I'm not used to anything more than 80 degrees."