500,000 migrants needed: Treasury
The ageing population and the implications on levels of migration is one of five key areas considered in the Treasury's latest analysis assessing an independent Scotland's fiscal position between 2016 - the first year of independence - and 2035/36.
Scotland's population is projected to age more rapidly in the future compared with the UK as a whole.
The Treasury has considered the levels of net annual migration which would be required in an independent Scotland in order for it to achieve a "dependency ratio" equivalent to that projected for the UK over the next two decades.
The dependency ratio is the number of people who are predominantly receiving from the state - pensioners - versus the number of people who are paying most of the taxes into the state - working-age adults.
Using Office for National Statistics data, the Treasury has calculated that Scotland would have to treble its rate of net annual migration under independence to match UK demographics.
As part of the UK, net annual migration to Scotland of 7,000 is assumed but this would have to increase to 24,000 under independence to achieve the same dependency ratio, it said.
"We assume that Scotland would have higher migration as an independent country than it would have within the UK, because that's what the Scottish Government have said and we want to take that into account, but you still see more of a demographic challenge," the Treasury said.
"To get the demographics simply to match the UK, Scotland would have to go up to the 'high migration scenario', which is 24,000 people a year net, so that's more than tripling in migration relative to Scotland within the UK.
"Over the 20-year period that we looked at that would basically be the equivalent of adding the population of Edinburgh to the Scottish population.
"So that would be a very substantial change in Scotland's demographics needed simply to keep this dependency ratio online.
"All of this challenge is simply smoothed away within the union and borne across the population as a whole."
The Scottish Government has already indicated in its White Paper on independence that it plans to adopt different immigration policies to those of the UK to meet Scotland's needs, including boosting its working-age population.
Scottish Conservative MSP Alex Johnstone said: "Migrant workers play a vital role in Scotland's economy and many of our successful businesses would not be able to cope without them.
"But under the SNP's hare-brained separation plans, we would need an open-door approach just to have a fighting chance of balancing the books.
"That would require a different immigration policy to the rest of the UK, which would without question mean border controls were an absolute necessity."
Scottish Labour's pensions spokesman Gregg McClymont said: "Pooling and sharing our resources across the whole of the UK means pensions are more affordable in Scotland. Only separation puts the pensions of Scots at risk.
"The nationalists tell us they will plug the pensions gap in a separate Scotland by increasing immigration but have failed to set out any plan."
General Register Office for Scotland figures show that between 2003/04 and 2010/11, Scotland saw net annual migration gains of at least 18,600 per year.
In 2010/11 the net migration gain was 30,200, however it fell to 12,700 in 2011/12.
A spokesman for Finance Secretary John Swinney said: "Net migration to Scotland is already more than 10,000 a year and independence will allow us to have a flexible policy to suit our economic needs, unlike UK immigration policy which is harming Scotland and which has just this week been condemned by one of Scotland's leading university principals as 'trying its best to destroy a global brand'.
"It is deeply revealing, but not surprising, that the Treasury's main attack on independence plays the immigration card, as the Westminster establishment panders to a Ukip agenda."