ON APRIL 12th almost 1,500 economists of varied political hues wrote to Donald Trump, urging him to consider the advantages of immigration. The benefits to America “far outweigh” the costs, they explained. Not only are immigrants often skilled (especially in the sciences) and entrepreneurial, they also tend to be young. As the baby-boom generation enters retirement, a demographic counterweight will come in handy.

Mr Trump, who did not win the presidency by listening to economists, proceeded to order a review of high-skilled visas on April 18th. The order is vague; his language was not. “We’re going to defend our workers, protect our jobs and finally put America first,” he said. On this issue the wonks can stand firm: highly educated immigrants are indisputably good for America. Still, they should not claim too much. As a treatment for America’s long-term budgetary malaise, immigration is probably more of a painkiller than a cure.

The effects of immigration are hard to calculate, for three reasons. The first concerns timing. Were it not for immigrants and their children, the working-age population would be shrinking (see chart 1). More workers means the cost of supporting retirees is spread over more people. But these new taxpayers will eventually retire and claim benefits themselves. By 2050 nearly a third of the foreign-born population is expected to be over 65.

A second difficulty is that the costs and benefits of immigration fall on different levels of government. Workers pay federal taxes, but get comparably little back from the central government until they retire. In the interim, state governments pay to educate their children, at an average cost of $11,000 a year per child.

Consider a related issue—the effect of legalising illegal immigrants already in America. The immigration reform that passed the Senate in 2013, only to fail in the House of Representatives, would have reduced deficits by 0.1% of GDP in its first decade and 0.2% of GDP in its second, according to official estimates. That bill would have provided a path to citizenship for illegal immigrants, which would have made them eligible for social security after ten years of work. Yet the cost of these pension promises was largely invisible, and even the short-term estimates covered only the federal budget. The Heritage Foundation, a conservative think-tank, claims that the full cost of a so-called “amnesty”—ignoring other parts of the reform—is $5.3trn over 50 years, assuming no future changes to entitlement spending.

The final problem is the number of fiddly assumptions needed to work out the fiscal contribution of anyone, let alone immigrants. How, for instance, should analysts treat spending on public goods, such as defence? This need not rise with population, but in practice it tends to. At what rate should they discount the tax payments of immigrants’ descendants? How might taxation and spending change in future?

A large panel of economists, convened by the National Academies, has tried to untangle this mess. Last September they estimated the fiscal impact of immigrants over 75 years, under different sets of assumptions. One scenario is shown in chart 2. It ignores public goods and assumes that taxes and spending grow at the same rate as productivity. It shows that, like natives, immigrants tend to benefit the treasury only if they are well-educated. The net contribution of an immigrant with a bachelor’s degree is worth over $200,000 now. A thinly educated immigrant costs $115,000. Broadly, immigrants to America are less educated than natives. In recent years, 21% had less than a high-school education, compared with 7% of American-born folk. This brings down their estimated fiscal contribution over 75 years to $92,000 each (under the given assumptions). If all immigrants, rather than only recent ones, are counted, the number turns negative. Might low-skilled immigrants instead contribute to the coffers by having plenty of children? Immigrants have a fertility rate (the number of children per women) of 2.3, compared with 1.9 among natives. Their children are more socially mobile, which also helps. Partly as a result, a 25-year-old immigrant is almost always a better bet for the public purse than a 25-year-old native with a comparable education. Yet immigrants’ social mobility is still low in absolute terms. Children of foreign-born parents who did not finish high school are thought to have less than a one-in-fifteen chance of graduating from college. The descendants of low-skilled immigrants are likely to remain a fiscal drag.

Even on the rosiest assumptions, much more immigration than is feasible would be needed to support the greying native population. The most generous model values the likely net fiscal contributions of a graduate immigrant of working age, and of his or her descendants, at a little over $500,000 over 75 years. A rough calculation suggests that almost 40m such immigrants would need to arrive immediately in order to fill the hole caused by social-security payments and hospital visits for the over-65s. They would have to be followed by 36m more by 2047—arrivals that are already baked into budgetary forecasts. Migration on such a scale seemed unlikely even before the immigrant-bashing Mr Trump came along.

Whether they come as immigrants or as babies, new arrivals cannot change the fact that America promises more in benefits to its residents than it takes from them in taxes. Highly skilled migrants help the public finances—more so, probably, than comparably educated natives. But they cannot provide much of an escape from the coming fiscal squeeze.