Scientists in Britain claim to have solved the prehistoric mystery of how dinosaurs got their long necks, in research that owes much to the design of 1950s vacuum cleaners.

The impressive necks sported by giant sauropods in the Jurassic period allowed the beasts to forage over large areas without having to waste energy moving their enormous bodies around, the researchers report.

Their striking anatomy resembles the solution that engineers came up with when they realised that early vacuum cleaners were too cumbersome to drag easily around a room. To allow the user to reach more carpet, they fitted the machine with a lengthy hose.

Calculations by Prof Graeme Ruxton at Glasgow University and Dr David Wilkinson at Liverpool John Moores University show that a 25-tonne brachiosaurus used 80% less energy foraging for food when its neck reached 9 metres from its torso than if had reached 6 metres.

With a 6-metre neck, the brachiosaurus could only have reached food immediately beneath or above it and would have had to move to reach more, but a longer neck gave the creature the ability to chomp on plants further away while standing still.

This long, slender neck could only support a small, light head, and so sauropods were not equipped with the large jaws and teeth needed to break down plant food a lot before swallowing it. Instead, the food had to spend a long time being digested in the animal's stomach.

"We draw analogy here with the cylinder vacuum cleaners that were commonplace in households in industrialised countries from the 1950s to the 1970s," the scientists explain in the journal Biology Letters

"Because the machinery required to create the suction was large and heavy, the main body of the vacuum cleaner was positioned by the user in a central location within a room, and the user then moved a light head-part at the end of a long tube across the surrounding carpet."

The sauropods include many of the best known prehistoric animals, such as diplodocus and apatosaurus – the dinosaur formerly known as brontosaurus. Some sauropods were more than 40 metres long from snout to tail and weighed over 100 tonnes.

While vacuum cleaners have evolved over the past half century into smaller, lighter, more agile beasts, sauropods were wiped off the face of the Earth by the chance arrival of an asteroid 65m years ago.

Writing in the journal, the scientists explain that the benefits of a longer neck would rapidly vanish were it to grow too long. "We would not expect runaway selection for ever-longer necks," they write.

The long necks of sauropods are the focus of an ongoing debate among dinosaur experts, with some saying that the animals predominantly held their necks straight out in front of them, while others argue they held their heads high by curving their necks into graceful swan-like S-shapes.