The whole keyboard lights up and blinks on and off. Yes, I am guessing the CPU is bad. I did switch the RAM as a test and it gave error. So assuming it the CPU and not bios. I did read that these get hot. The battery was very swollen.
What error did you get?
Are you sure you switched it with compatible RAM?
The battery being swollen isn't a good sign, and yes, it could be the CPU, but I'd try everything possible to rule that out (Since that would mean a very expensive replacement to get it working again).
If this is a laptop, most HP's CPUs are integrated to the MOBO or System Board as they call it in their documentations. If you are able to get an error with no memory in it but no post with the memory that would indeed mean a bad system board.
If the device is still under warranty you can let HP support know about it and they will issue a ticket about it, the less information you give them about it the better. They usually won't do too much for consumer damages.
However you are in luck, if you aren't under warranty you can find out the part numbers for your model with HP's part surfer
hp 840 g3 only has the integrated HD graphics (within CPU) so its pretty rare it goes bad. If you remove all ram and boot with only cpu you should get beep/blink codes for missing ram that means motherboard is "most likely" fine. Does not still mean there can be problem with it.
With HP laptops failure is 80% the gpu chip, that was the case atleast 5-10 years ago this might of changed. Ive had the 1 blink been multiple different things, from corrupted bios, bad bios chip, dying northbridge and gpu chip etc.
You can try to recover bios with Windows + B key at startup, follow this guide, If you cant get into bios recovery mode with it (might be different key combination too) then even the USB method wont work, just try the recovery mode without usb stick first, then do the steps below this then come back to this video and try the USB method if needed:
Like previous poster said always go for warranty first, if its OUT of warranty then you can try the basic. Check for broken USB ports on the laptop, looking for shorted pins (always remove power cable when removing or touching anything, also first thing to do is remove main battery from the laptop) seen at 2min40sec on below video
remove main battery and power cable, press power button for 30sec-1min continuously, plugin ONLy power cable and try to boot. If it boots without battery then battery is bad.
if that doesnt work you can see the small cmos coin battery on the right (covered with black tape) , remove the white ribbon cable connector carefully which connects it to motherboard. wait for 10minutes and plugin the cmos batery back and try to boot.
Next is obviously take it apart until basics left (with non conductive surface), motherboard , ram , cpu, power cable. Nothing else, then plugin power cable and see if you get beep/flash codes, if no monitor cable is connected you obviously cant see picture anywhere. If it boots like this then problem is somewhere on the way like shorted LCD screen / connector, or wifi card , whateevr can be the cause. If it works barebone then find the cause by slowly adding things back and testing in between, make sure to always use non conductive surface and remove power cable between attempts, and obvioysly main battery need to be disconnected at all times.
Thank you for all of your input. More digging than I was willing. This computer had a. lot of issues and looked like it had been worked on several times. I had read that these machines are not all that great, hence perhaps inexpensive.