AMHERST, N.Y. (WIVB) – The National Football League schedule consists of 272 regular season games; 32 teams playing 17 games each. Sounds simple, right?

Wrong.

“The combinations of those is 17 times 16 times 15 times 14 times 13… that’s 355 trillion – for one team – possible orders of their games,” said Dr. Mark Karwan. “If you include the bye week, it’s over 3 quadrillion.”

Karwan is a professor of industrial engineering at the University at Buffalo who knows a thing or two about schedules. In the early 2010s, one particular Bills schedule left him dismayed.

“What happened was the Bills the previous year had five games (against teams coming off) byes,” he said. “And four of them were against divisional opponents.”

He started to do some independent research around that time. The NFL eventually took notice. Karwan is now in his fourth year leading a team at UB which tests out scheduling concepts under a league grant.

“This is my field for the last 46, 47 years. It is the hardest problem I’ve ever seen,” Karwan says.

The NFL’s considers a lot when crafting its 18-week slate, league spokesperson Brian McCarthy said in an email.

“Our schedule makers talk to a wide variety of fans, coaches, players, broadcasters, and academics to listen and learn on how to improve,” McCarthy said. “We’ve talked to Dr. Karwan over the last several years to discuss how we can use data and analytics to improve the schedule.”

“(The league is) running everything in the cloud,” Karwan says. “They’re doing all that. We’re doing research behind the scenes. Could we have a method or algorithm? Which 70 games do you fix (in a certain slot) to get a better schedule?”

It started as a concept of how to make the schedule fair for teams across the league. But it’s morphed into something different.

“You need to have reasonable viewership all the time,” the professor said. “That’s what we’re doing now. Less with scheduling and more with data analytics for viewership.”

“Because in the end, yes we want good schedules and we want a lot of viewership,” he added. “But the viewership wasn’t really built into it. Now it makes it even harder, the mathematics.”

Specifically, Karwan says his team is looking into analytics related to the league’s 1 p.m. and 4 p.m. broadcast windows on Sundays. McCarthy acknowledged the conversations over the past year have included a discussion about viewership patterns.

“A good football fan can figure out what the top 40 or 50 upcoming games are,” Karwan says. “Unless somebody tanks or (Patrick) Mahomes gets hurt – we don’t talk about (Josh) Allen that way. And so you know what is going to be primetime. It’s just a question of when: Monday night, Sunday at 4:30, Sunday night.

“But what about the 1 o’clock and 4 o’clock games? That’s where we’re working with them now because CBS and FOX need good viewership for those too.”

Imagine that there was a time when schedules were put together without computers. Those days are long gone.

“The schedules have improved dramatically with the use of computers and mathematics,” Karwan said.

Chris Horvatits is an award-winning reporter who joined the News 4 team in December 2017. See more of his work here.