Just for completeness:
Peter Diehr is correct, Manetho, who lived during the Ptolemeic era (which has several kings named Ptolemy) wrote a book about the royal dynasties of Egypt. His sources must have been royal annals, which would record the name of the pharaohs and how long they reigned.
The original book is lost, and only shortened and inaccurate transcripts of transcripts have survived, but those are the source of the division of the pharaohs into dynasties which are used in Egyptology today.
Manetho assigns the Great Pyramid to the 2nd king of the 4th dynasty, who he names Suphis. The overwhelming majority of the available evidence today seem to confirm that and point to Khufu.
So yes, one of the Ptolemaic kings could have known who built the pyramid.
And since the Egyptians, including Manetho, counted the length of the reign of each pharaoh, he could have added those together and would have had an idea when they were built.
There where many possible sources of errors of course: Some pharaohs have been excluded from the royal annals for political reasons ("damnation of memory"), the way the reigning years have been counted could have changed ("cattle counts"), scribes made copying errors, having completely accurate lists was not the primary purpose of the annals and there were two long periods of unrest and chaos, during which several pharaohs appeared and vanished in a short time and the royal annals had trouble counting those.
In summary, a learned one could have told a Ptolemy (after studying the archives) a number like "2337 years" as an answer, but that number would likely be not 100% correct, although it might have been close.