Retaining a large number
Can you hold the number 7859385 in your head for an extended period without the image of the number becoming distorted at any point?
Long term memory of a single long number: Obviously a large proportion of people remember a few phone numbers that are at least as long as the number you mention. So for long term recall there are many strategies for retaining long sequences of digits:
- practice seeing the number and trying to recall the number
- try deeper encoding strategies that try to give some structure or meaning to the number
- A focussed desire to retain the number
Sustained short term memory of a single long number: However, it seems like you are talking about scenarios where you are trying to hold some arbitrary large number in your head and that number is different from occasion to occasion. In general, there are many studies on digit span which look at the length of numbers that can be reliably retained in working memory by normal untrained participants. The traditional claim is that people can hold sequences of digits between about 5 and 9 in their head, but presumably this would depend on a number of factors.
In particular, distraction can often destroy the contents of working memory. Distraction can often come from external sources, but could even be internally driven.
In the case of mathematics, the need to perform other steps in a calculation are a good reason to store intermediate steps externally (e.g., on paper, whiteboard, computer).
Training
Are there any exercises one could perform to improve his/her visual retention of objects and numbers in their heads?
Training of of short term memory of single long numbers: The Ericcson et al study mentioned by John Henry is a classic study in the expertise literature. The participant was a runner and used a mnemonic strategy based on running times to be able to increase their digit span to well above normal levels. As @John mentions, this skill did not transfer to memory for other objects. It was not a fundamental change to intelligence or working memory capacity. Rather it was a modification to the way that numbers were processed that enabled greater meaning to be given to numbers.
General thoughts: I would not specifically try to learn how to retain numbers in your head, unless that's a party trick that you think would be fun. If you want to get better at a particular form of mathematics, then practice doing problems in that area. In that case, the problem space itself is likely to suggest what you should retain in long term memory, and what can be computed. Or there may be particular problems where you make a deliberate effort to retain in long term memory (e.g., the first few digits of $\pi$ or $e$). Similarly, the more time you spend doing mathematics, the more meaning that will be associated with numbers. In general, richly interconnected mental objects are easier to recall and manipulate.