I know we use "an" in front of letters/words based on their sound(i.e. whether their sound starts with a/e/i/o/u).
What I would like to know is whether the rule is different while writing. I mean is it correct to WRITE "an useful prediction", but SAY "a useful prediction", or it should be "a useful prediction" even while writing.