Ask most folks the one thing President Obama has done that will leave a stamp long after he has left office, and they'll say ObamaCare. But with the possibility of both a Republican president and Republican Congress in power as early as 2017, that's far from guaranteed.

By far the best way for any president's influence to endure for years — perhaps decades — is through his appointments to the Supreme Court. Ronald Reagan left the White House a quarter-century ago, but his philosophical views live on through his appointee Antonin Scalia. Three conservative appointees of the Bushes — Clarence Thomas, Samuel Alito, and Chief Justice John Roberts — are going strong and will be around for years to come. Of course, not all justices work out the way presidents intend when they are nominated: Reagan's other appointee, Anthony Kennedy, is regarded as the court's swing vote, as likely to side with the court's four liberals (Ruth Bader Ginsburg and Stephen Breyer, both Clinton appointees, and Sonia Sotomayor and Elena Kagan, appointed by Barack Obama) as its four conservatives.

So with two-and-a-half years before he leaves office, there's nothing President Obama would love more than to appoint a third, even a fourth liberal justice to the court. His problem: the conservative judges he would like to replace are younger on average than the liberal judges. Even with Scalia, who at 78 is the oldest of the conservative quartet, the average age of the four conservatives is 66.7. The four liberal justices are, on average, nearly a full year older, at 67.5. This includes the oldest justice of all, 81-year-old Ginsburg, appointed by Clinton in 1993.

For years, rumors have swirled around Ginsburg, who has battled both colon and pancreatic cancer, that she would appear to be the most likely to step down from office. But "all I can say is that I am still here and likely to remain for a while," the frail-looking justice told Yahoo's Katie Couric last week.

What about Scalia? The biggest thorn in the side of the liberal wing — known, says biographer Bruce Allan Murphy, for his "almost pathological unwillingness" to compromise with liberal colleagues — told CNN in 2012 that "of course I'll retire…I'll retire when I think not doing as good a job as I used to. That will make me feel very bad."

Unfortunately for progressives there is no evidence that "the Ninopath" — as Scalia is sometimes called by critics — thinks he's doing a poor job.

The election calendar comes into play here. If Ginsburg wanted to ensure that her eventual successor was a fellow liberal, she should consider retiring before Obama's term is up, so he can safely nominate a like-minded justice. Scalia, on the other hand, should stick it out — conservatives would go crazy if he were to retire, before Obama leaves in January 2017. Replacing Scalia with a liberal now would decisively shift the court in favor of its liberal wing, with obvious implications for everything from abortion, affirmative action, and civil rights to campaign finance and future challenges to the Affordable Care Act. For this reason alone, Hillary Clinton in the Oval Office would be a conservative nightmare: Ginsburg could safely retire and Scalia, a few months shy of 80, would have to decide whether to stick it out for another four to eight years. Swing vote Kennedy, who would also then be 80, may also decide it's time to pack it in.

On the other hand, if a Republican wins the White House, the tables are turned. Scalia could safely go and a conservative would replace Ginsburg. That would be the left's ultimate nightmare.

You can bet that Ginsburg, Scalia, and any other justice who is dreaming of hanging up their black robe, is aware of these considerations. Supreme Court justices tend to retire at a much greater rate, says this study, if the president in office at the time is from the same party as the one who nominated them. In other words, Ginsburg should retire now and Scalia should hang on.

Meantime, if he has another chance or two to appoint a justice, here's some advice for President Obama: get 'em young. The average age of the four liberal judges when they were appointed to the court was 54.5. The average age of the four conservative judges when they were appointed? Just 49.5. This explains why Clarence Thomas, after Scalia the justice libs most detest, has been around for 23 years come October, but is only 66 years old. Conservative presidents have left their mark on the Supreme Court for much longer periods — simply by appointing much younger justices.