Most people chat with their Uber driver about traffic or the weather. Sam Ferguson, on the other hand, spent one January Uber ride diving into tax math—and unearthed a big problem for many Obamacare customers.

Ferguson, 27, a math Ph.D student at New York University, was on a trip to Iowa when he got to talking with his Uber driver about their jobs. The driver told Ferguson that he had trouble calculating the premium assistance he was eligible for under the Affordable Care Act, also known as Obamacare. People without job-based coverage making up to $48,560 are eligible for government help paying their monthly health insurance bill.

The driver followed the instructions provided by the IRS, but struggled to come up with a definitive amount for his total premium tax credit. This number goes on Form 8962, which Obamacare customers must fill out when they file their federal income taxes, due this year on April 17.

Ferguson promised to look into the issue and report back, thinking it would be a simple matter of double-checking his driver’s math and looking for tax software glitches. But it turned into a months-long odyssey—involving reams of IRS publications, a supercomputer, a Google engineer, and a former tax attorney turned Congressional candidate.

As it turns out, Ferguson had stumbled onto a known, but only obliquely acknowledged, problem with the IRS subsidy-calculation methodology. It affects an estimated 100,000 households, or up to 500,000 Americans, according to Ferguson’s estimates, forcing them to pay more than they should for health insurance.

Stuck in a Loop

The problem goes all the way back to the passage of the Affordable Care Act in 2010. Although the health insurance law is “internally consistent,” Ferguson says, plunking it down on top of existing tax law created a circular relationship between two key numbers.

Line 29 of the 1040 tax form asks self-employed workers for their health insurance deduction. In order to determine this number—for Obamacare consumers, it’s typically the sticker price of your health insurance minus any government assistance—you need your total premium tax credit from Line 24 of Form 8962. But in order to get your total premium tax credit, you need Line 29 from Form 1040. “It’s a loop where the output affects the input,” says Leiden Cervantes, 23, a math student at the University of Iowa and the friend whom Ferguson was visiting back in January.

“We are aware of the topic,” wrote Mark Ciaramitaro, vice president of tax strategy at H&R Block, in an email message.

The IRS has also acknowledged the circular relationship, though it did so in a procedural document—not something that stumped taxpayers would generally uncover if left to their own devices. In another document, the IRS presented two solutions that taxpayers can use to escape this infinite loop and arrive at their correct premium calculation.

“The IRS put a lot of work into creating the different methods to resolve the circular calculation around the premium tax credit for self-employed taxpayers,” Ciaramitaro wrote.

These solutions do in fact work—most of the time. The Uber driver’s case was one of the exceptions. (Through Ferguson, the driver declined an interview request from MONEY, citing concerns about his immigration status.)

To understand the problem, you need to understand the way federal Obamacare subsidies work. As a consumer’s income rises, the level of the premium subsidy declines. Government help drops off completely at 400% of the poverty level, or $48,560 per year for an individual. In other words, someone who makes $48,561 would receive no federal assistance for purchasing health insurance.

Fixes Fail

The trouble is that both of the IRS’s suggested fixes break down when a taxpayer’s modified adjusted gross income is close to the income thresholds for government assistance, Ferguson says.

One method gives consumers a lower federal insurance subsidy than they’re actually eligible for. And because it’s not apparent that they’re being shortchanged, most people simply accept the lower amount and pay more for insurance than they should, says Ferguson, who since his discovery has advised families in this position.

The other IRS method leaves consumers toggling endlessly between subsidy eligibility and ineligibility, failing to arrive at any amount of premium tax credit at all.

Asking the IRS to Change

“The problem with the IRS calculations is they don’t work very well on the margins,” says Archie Parnell, a tax attorney and former staffer of the House Ways and Means Committee who is now running as a Democrat in South Carolina for a U.S. House seat.

With the assistance of Parnell—whom Ferguson was introduced to via his parents’ church in South Carolina—the math student has contacted an official at the IRS to share his own solution, which generates an accurate premium tax credit across all incomes. Ferguson was able to prove his solution, which uses a series of averaging calculations, with the help of his roommate—a mathematician who uses supercomputers to process large volumes of data.

Ferguson says the IRS official in essence told him, “It’s great that you solved it, because we haven’t.” Ferguson says he was told that if he publishes his findings in an academic journal, then the IRS will link to the report as guidance for calculating premium subsidies.

An IRS spokeswoman confirmed that Ferguson contacted the agency but declined to comment on the substance of the conversation.

Ferguson is now approaching academic journals to publish his findings. With the help of a former roommate who now works as an engineer at Google, he has also created a preliminary calculator that people can use to ballpark their premium subsidy, to help determine whether they’re in one of the problematic income bands—and he’s working on a free app that will go even further, telling people of any income what premium subsidy they’re eligible for. The calculator provides a ballpark because it assumes a simple tax profile, but the app will be customizable to handle any number of situations.

Meanwhile, Ferguson continues to talk about his work to any Uber driver he meets. “The one in New York understood it,” he says, “and the one in South Carolina didn’t.”