It never stays white for long because of EU Directive 2004/42/EC. That forced paint manufacturers to reduce the levels of VOCs (volatile organic compounds) in paint, with an initial reduction in 2007 and then a far greater one in 2010. It's those VOCs (as solvents) which helped to keep the paint white.
Acrylic gloss paints don't use those solvents and so keep their whiteness far longer. So that's what you should be seeking out. However they cost roughly twice as much as conventional gloss paints.
I've used Farrow & Ball paint which wan't brilliant white, but hasn't visibly faded after 4 years, compared oo other rooms in the house. It's very old fashioned stuff and horribly expensive, but goes on beautifully.
I had this qustion a while ago and someone said they always added a tiny bit of blue into the white paint. Like they used to do years ago when doing whites in the washing.. they used to put in what was called a blue bag..it kept whites white.