With a bit of help from the Mormons, PBS’ “Finding Your Roots with Henry Louis Gates Jr.” discovered that Sen. Bernie Sanders and the man who parodied him on “Saturday Night Live,” Larry David, are related.

(Photo by Chris Pizzello/Invision/AP) Actor/creator/executive producer Larry David speaks in the "Curb Your Enthusiasm" panel during the HBO Television Critics Association Summer Press Tour at the Beverly Hilton on Wednesday, July 26, 2017, in Beverly Hills, Calif.
(AP Photo/Mike Groll, File) In this June 24, 2016, file photo, Sen. Bernie Sanders, I-Vt., speaks in Albany, N.Y.

The series doesn’t deal directly with the church. But Gates said his show owes a lot to the records kept by The Church of Jesus Christ of Latter-day Saints.

They have a head start of almost 200 years,” Gates said. “They have low labor costs, and they have this passion about doing it because it’s part of their belief system. And they trace the ancestry of everybody.”

The show’s lead genealogist, Johni Cerny, is based in Draper. The show’s primary sponsor, Ancestry.com, is based in Lehi.

And Gates calls Salt Lake City “ground zero for genealogy because of the records” assembled by the LDS Church.

(Photo by Richard Shotwell/Invision/AP) Henry Louis Gates Jr. participates in the "Finding Your Roots" panel during the PBS portion of the 2017 Summer TCA's at the Beverly Hilton Hotel on Monday, July 31, 2017, in Beverly Hills, Calif.

Some of those records helped in the investigations into their families. As viewers learn in Tuesday’s episode (7 p.m., KUED-Channel 7), both men knew little of their family histories — which are filled with similar tragedies. They’re both descended from Polish Jews, who suffered multiple tragedies in the first half of the 20th century. And there are other surprises that leave Sanders and David stunned.

Gates said he tried to talk his “good friend” David into participating in “Finding Your Roots” for years.

He would say, ‘Yeah, no.’ Then finally, one day out of the blue, he said he was in,” Gates said. “Then we asked Bernie Sanders, and he said yes. So it was obvious to put them together in an episode because of Larry’s fabulous imitation” on “Saturday Night Live.”

They weren’t expecting to discover that the two are related.

Then we get to the DNA,” Gates said. “They share identical DNA on chromosome 7, 9 and 11. That’s a lot.”

It indicates that Sanders and David are third or fourth cousins.

In retrospect, when you see all that DNA they share — my God, it’s a natural,” Gates said. “But I’m not saying that from a scientific point of view.”

After learning unsettling and downright distressing things about their family histories, the news that Sanders and David are related provides a bit of relief.

What the hell!” David exclaims in surprise. “That is so funny!”

You’re kidding!” a visibly startled Sanders blurts out. “This is unbelievable.”

Gates will be visiting what he calls “genealogy heaven” in March. He’s accepted an invitation to RootsTech 2018 at the Salt Palace.

It will be packed with people who are Mormon, I presume, and people who are genealogists. I can’t wait!” he said.

(Photo by Richard Shotwell/Invision/AP) Henry Louis Gates Jr., from left, Ana Navarro, Ted Danson and Janet Mock participate in the "Finding Your Roots" panel during the PBS portion of the 2017 Summer TCA's at the Beverly Hilton Hotel on Monday, July 31, 2017, in Beverly Hills, Calif.