I don't recommend doing so.
Tried gaming on a pentium 4 with 9400GT games stutter and frames drop.
Tried gaming on a pentium dual core and it was smooth with everything on low settings.(Better than Pentium 4)
I recommend getting a used Core 2 duo or Core 2 quad if you can and avoid Pentium 4 at all cost.
Pentium 4 is not only slow by today standards but it also takes a lot of power to operate and produce a great amount of heat.
An Intel Atom is vastly superior to a Pentium 4 in terms of performance as well.
Pentium 4's were low performers when they were released compared to the vastly superior Athlon 64.
The game will not be playable on a Pentium 4 no matter how good of a graphics card you install.
The minimum recommended processor for GTA 5 are quad cores:
Intel Core 2 Quad CPU Q6600 @ 2.40GHz (4 CPUs) / AMD Phenom 9850 Quad-Core Processor (4 CPUs) @ 2.5GHz