David Currie,
I think you will find there is no direct connection between the serial number of the aircraft (XS581) and the number painted on the nose (382).
The serial number is allocated at the time of the aircraft being ordered and it remains with it throughout its life.
The 'fleet number' (382), for want of a better title, is related to the unit and location and can be changed if - say - an aircraft on 'X' Sqn operating off carrier 'Y' is subsequently sent somewhere else, perhaps one of the training sqns.
I'm sure a jolly Tar will explain it better than a 'Crab' but that's the essence.
Old Duffer