Memorabilia is sold before Donald Trump speaks at a rally at Atlantic Aviation on Saturday in Moon Township, Pa. (Jeff Swensen/Getty Images)

Donald Trump ran a brilliant Republican primary campaign. The problem? He’s running that exact same campaign in the general election.

Trump cruised to the Republican nomination on the strength of his hard-line stance on immigration (build a wall, make Mexico pay for it) and his willingness to savage the other 16 people running against him (“Low energy” Jeb Bush, “Little Marco” Rubio, “Lyin’ ” Ted Cruz).

More than 13 million people cast a vote for him in the Republican primaries. That was almost double what the second place finisher — Cruz — won.

The problem, if you are a Republican, is not only that Trump appears to have learned lots of wrong lessons from that winning campaign but also that he seems to not grasp that the way you win a primary is very different from the way you win a general election.

“You think I’m going to change?” Trump asked reporters rhetorically in a news conference late last month. “I’m not changing.”

Presumptive Republican nominee Donald Trump took aim at Sen. Elizabeth Warren (D-Mass.) at a rally in Tampa, Fla., on June 11. He called Warren "Pocahontas," a jab at her claim that she is of Native American descent. (Reuters)

In Trump’s mind, his willingness to be politically incorrect — whether it’s raising questions about the Mexican heritage of a federal judge overseeing a case involving Trump University, attacking Mitt Romney, the 2012 Republican presidential nominee, as having “choked like a dog” or repeatedly referring to Sen. Elizabeth Warren (D-Mass.) as “Pocahontas” — is an appealing strategy.

And those are just things Trump has done in the past three weeks!

[Trump’s ‘Pocahontas’ attack leaves fellow Republicans squirming (again)]

If it worked in the primary, it’ll work in the general: That’s the Trump logic. The problem with that? Well, there are lots of issues with it, but the main one is this: The general electorate is significantly larger and more diverse than in a Republican primary.

As I mentioned above, Trump got more than 13 million votes in the Republican primary process: 13.3 million to be exact, according to RealClearPolitics.

Now, compare that with how many votes Romney, a.k.a. the choking dog, got in the 2012 general election: 60.9 million. And Romney lost — convincingly — to President Obama, who got nearly 66 million votes.

Romney’s popular vote numbers are no outlier. John McCain got nearly 60 million votes while being crushed by Obama (69 million votes) in 2008. George W. Bush got 62 million votes in his 2004 reelection win.

It’s a reasonable assumption then that Trump will need at least 60 million votes to win the White House this fall — and almost certainly north of 65 million given population growth in the country.

[Trump doesn’t have a national campaign. So the GOP is trying to run one for him.]

That’s about five times the number of votes he received in the primary. Much of that difference will be made up by the fact that lots of Republicans simply don’t vote in GOP primaries but will almost certainly turn out in a general election — even if it’s only to cast a vote against Hillary Clinton.

But, assuming what worked to win 13 million votes is a sure-fire recipe for winning five times that number seems to be a decidedly shaky proposition.

Why? Because we know from recent presidential history that the electorate of a Republican primary is whiter and older — by a considerable amount — than the general electorate.

Let’s, for example, take a look at the swing state of Florida, which also happened to be one of Trump’s strongest states in the primary process.

In the Florida GOP primary in March, 74 percent of voters were 45 or older. Seventy-eight percent were white, while 16 percent were Latino and 3 percent were black.

In the 2012 Florida race between Obama and Romney, which the incumbent won by one percentage point, just 61 percent of voters were 45 or older. Sixty-seven percent were white, while 17 percent were Latino and 16 percent were black.

(Nationally in 2012, 54 percent of the electorate was 45 or older. Seventy-two percent were white, compared with 13 percent who were African American and 10 percent who were Latino.)

It doesn’t take a mathematician to see why those differences between a primary voter pool and a general electorate are problematic for Trump.

In the latest Washington Post-ABC News poll conducted in May, Clinton led Trump 47 percent to 39 percent among voters ages 18 to 39. Among non-white voters, her edge was massive: 69 percent to 21 percent.

Trump appears to either be ignorant of or simply willing to ignore the vast differences between what can be a winning formula in a Republican primary and what adds up to a majority in a general election in 2016.

That’s something that deeply worries Republican elected officials trying to hold fast to their majorities in the House and the Senate. If Trump continues to run a Republican primary campaign masquerading as a general election campaign, it might cost his party not only the White House but also the majority in Congress.