It’s good to have friends, for humans and chimpanzees. But the nature and number of those friends change over time. In young adulthood, humans tend to have a lot of friendships. But as they age, social circles narrow, and people tend to keep a few good friends around and enjoy them more.

This trend holds across many cultures, and one explanation has to do with awareness of one’s own mortality.

Zarin P. Machanda, an anthropologist at Tufts University, and her own good friend, Alexandra G. Rosati, a psychologist and anthropologist at the University of Michigan, wondered whether chimpanzees, which they both study, would show a similar pattern even though they don’t seem to have anything like a human sense of their own inevitable death.

The idea, in humans, Dr. Machanda said, is that as we get older we think, “I don’t have time for these negative people in my life, or I don’t want to waste my time with all of this negativity.” So we concentrate on a few good friends and invest in them. This explanation is called socioemotional selectivity theory.

Dr. Rosati and Dr. Machanda, who is the director of long-term research at the Kibale Chimpanzee Project in Uganda, drew on many years of observations of chimps at Kibale. Along with several colleagues, they reported Thursday in the journal Science that male chimps, at least, display the very same inclinations as humans. The team looked only at interactions of male chimpanzees because males are quite gregarious and form a lot of friendships, whereas females are more tied to family groups. So male relationships were easier to analyze.

The finding doesn’t prove or disprove anything about whether knowledge of death is what drives the human behavior. But it does show that our closest primate relative displays the same bonding habits for some other reason, perhaps something about aging that the two species have in common. At the very least, the finding raises questions about humans.

Ian Gilby, an evolutionary anthropologist at Arizona State University and co-director of the Gombe Chimpanzee Database, part of the Gombe Stream Research Centre, who was not involved in the research, described the new study as “really elegant.”

“It makes the case that we should rethink our views about human behavior,” he added.

Dr. Rosati, Dr. Machanda and their colleagues looked at several aspects of male chimp behavior as recorded in more than 20 years of almost daily observations, with 78,000 hours of observations on 21 male chimpanzees from age 15 to 58. They used the proximity of chimpanzees to one another to determine friendships — friends sit together. And they used grooming to decide whether the friendships were mutual, with each chimp paying attention to the other, or one-sided.

As they got older, the chimps developed more mutual friendships and fewer one-sided friendships. They also exhibited a more positive approach to their whole community, continuing grooming of other chimps, including those that weren’t close friends, at the same rate, but with a drop in aggression. Other primates don’t necessarily follow this pattern as they grow older, according to the authors. Some monkeys tend to withdraw from social relationships and their aggression levels stay high.

Of course, this can also happen in humans, but the data indicate that Aunt Ratchet and Uncle Vlad are exceptions.

The data analysis required for such studies is what happens after the field observation. Anyone who watches nature television shows can probably call to mind the image of Jane Goodall amid the Gombe chimps, or other similar, apparently idyllic portraits of field biologists.

Dr. Machanda said that people may think it’s just a matter of using an Excel spreadsheet. But she said that Excel won’t accept data “after something like 168,000 rows.”

“For most people, that would be insane to have a table that has that many rows, but actually I think in our database, our largest table has something like 4.7 million rows of data,” she added, with “dozens and dozens of tables.”

Dr. Gilby, who manages 60 years of data from the Gombe project, going back to the days when, he said, it was piling up in paper form at Dr. Goodall’s house in Dar es Salaam, said the new work demonstrated the importance of long-term studies.

Why chimps concentrate on fewer friends and behave less aggressively as they age are still unknowns. It could be a question of emotions becoming more stable. And the deaths of some friends would naturally reduce the number of relationships, Dr. Gilby said. Perhaps they “just don’t have the drive or the energy, or what-have-you to form new relationships.”

Or, the authors of the paper suggest, it could be that by maintaining an active and positive social life, the older male chimps maximize their chances to mate and reproduce, even at an advanced age. Older chimps do reproduce, but the authors don’t know whether an active social life, even among males, keeps them in the mix, so to speak, and increases their chances to father more offspring. That’s a subject for future research.

Female human friendships that grow stronger over time, Dr. Machanda pointed out, are certainly helpful for scientific research. She said that she and Dr. Rosati “have known each other since 2004 when she was an undergrad and I was a grad student” at Harvard.

“It really is a result of us being friends and just talking, having fun conversations about science over coffee,” Dr. Machanda said. “A lot of times, we think of that kind of science as being the product of this old boys’ network. But here’s our middle-aged girls’ network, or young girls’ network.”

And that’s related to another subject for future research: How friendships among female chimpanzees change as they grow older.