In the TNG episode "Where Silence Has Lease" the Galaxy class Enterprise NCC-1701-D encountered what seemed to be a sister ship the Galaxy class Yamato NCC-1305-E, but it turned out to be a fake ship created by the strange alien being Nagilum.
WORF: Captain, there's another vessel approaching in sector zero nine one, mark two six.
PICARD: On screen. Magnify.
RIKER: It's a Federation ship. NCC one three zero five dash E. It's the Yamato, our sister ship.
Where Silence Has Lease
In the TNG episode "The Measure of a Man" an Okudagram said, that the Galaxy class Yamato NCC-24383, commanded by Captain Richard Mackenzie was patrolling the Neutral Zone in sector 134.
In the TNG episode "Contagion" the Galaxy class Enterprise NCC-1701-D encountered the real Galaxy class Yamato NCC-71807 under the command of Captain Donald Varley.
A piece of hull from the exploding Yamato has 71806, but dialog in the episode establishes that the registry number is NCC-71807.
Thus we see that the USS Yamato also had a registry number with a letter suffix. Why did the Yamato also have other registry numbers? Maybe in the era of TNG some starships have two or more registry numbers at the same time, or maybe Starfleet kept changing the registry number of the Yamato for some reason.
In real life, this was the result of various errors and failures to communicate by the production staff of TNG. But in the universe of Star Trek each of the Yamato's registry numbers is correct and valid.
In the era when TNG was produced, physical models of starships would keep their hull markings as long as they lasted, or until someone physically repainted them. And computer graphic models of starships would also keep their hull markings until somebody reprogrammed them to show different hull markings. So a specific starship would have the same registry model on its hull every time it was shown.
But how do we account for the different registry numbers of the Yamato in the fictional universe of Star Trek, since each number is as canonical and correct as the others?
With the technology of almost 400 years in the future, it is easy to believe that it would be trivaly easy to program different parts of a starship hull to show different colors and thus to rewrite its registry numbers. Thus if Starfleet kept changing the registry number of the Yamato the hull would keep changing its pattern to show the new registry number. And if the Yamato had several different registry numbers at the same time the ship could be programmed to cycle between numbers on the hull, switching at regular intervals.
And since the ship could be programmed to display different registry numbers on the hull, the Iconian invasive program that was interfering with the ship's computer programming could have cause the number on the hull to change from 71807 to the inaccurate 71806 before the Yamato exploded.
And maybe the Enterprise also has two or more registry numbers, and its hull markings may display each on in turn in a regular cycle, but we only get to see one of those registry numbers, NCC-1701-D.