A Dynamic programming solution does NOT require 10^14 elements array. It only requires 3.
Note that each step is only using previous 3 elements, so for F(1000), you really do not need F(5).
You can simply override elements that are no longer needed, and regard them as a new number.
The % operator is your friend for this purpose.