You'd probably use a method called "chunking" to remember the number and encode it to short-term memory until you were able to write it down. Chunking is a way to think of a number so it is broken up into smaller pieces. It is kind of rhythmic. Some folks use different memory devices like rhyming as well. You just need a way to associate the information to be able to encode it.