MAS3:
Hi.I have no idea what 'nan' is.
I do not see any serial communication in your sketch.
But opening the serial monitor, causes a reset.
Perhaps your screen needs some extra time to reset after power on.
So try to have a larger delay() in line 18, and if that doesn't help, put in some extra delays in other lines, just to test.
NAN is normally "No A Number" it is normally used to denote division by Zero.
It is difficult to provide any help to the other person since they did not indicate which Arduino board they are using.
I would suggest that they post the question on the adafruit forums. they may have some better insight into the workings or not workings of the adafruit devices.