These are pretty good answers, but I would suggest that there is pair programming (2 people) and there is mob programming (whole teams) and there is swarming (some group of people on each of several tasks).
I described it a bit in this article: https://industriallogic.com/blog/swarm-programming-with-the-swarm-board/
I've seen "teams" which were basically talent pools using this multi-mob kind of swarming to complete tasks. The team member all worked with each other eventually, all 40 of them in a very large team, but they didn't all work with everyone else at once.
It worked pretty good. It's different from pairing and mob programming, but it works quite well in context.
I described it with more details in this article.