If your computer is still under warranty, I would contact HP support. I don't know if you have made any changes in BIOS, but go into BIOS and load optimized defaults, save and exit and see if that helps. Other tests you can run are
prime95 to test the CPU or
Furmark to test the Gpu. You can also run
checkdisk. I would suggest running
sfc /scannow to verify and repair any system files. If all of those tests pass with no problems found, it is likely it is a poblem with the motherboard/BIOS or a PSU.