There are two great apps for this I’ve found for Android: DreamLab and BOINC. Android devices are great because they are some of the most efficient-per-watt computation available, and cost anywhere from 25 cents to a few dollars to run per year depending on your device and power cost.
BOINC is a network of many different projects, you can pick and choose which you want, just install the BOINC app and attach to the projects you want. It’s a tad more complicated than DreamLab but way more powerful. There’s medical research (World Community Grid), space research (Einstein@home, Asteroids@home, Milkyway@home), math research, and more. Note that the version in the play store is basically non-functional, you’ll need to download from F-droid.
Note that many Android phones are not designed to effectively vent heat from 100% CPU usage constantly. Both of these apps allow you some degree of control over CPU usage, I generally set my devices to 50%. To be safe, remove batteries while these devices are running. It will help preserve battery life, increase power usage efficiency, and important will prevent your battery from becoming a dangerous swollen fire pillow.
The CPU will automatically scale down in most devices to keep the temp in a safe range. Batteries will swell for a while before they become an issue. As long as you aren’t browsing the open internet with it and are behind a NAT, patching probably isn’t a huge issue. But of course, always be mindful of how you use your devices particularly when it comes to security. A factory reset will remove all sensitive data from the device and give it a computational power boost as well.
Re: heat management. Putting the device on a rack (like one used for cooling cookies) and removing the case and/or cover can make a surprising difference. Heatsinks can also be applied to the case itself or to the processors themselves. I have several devices running at 100% with no issues thanks to some small heatsinks repurposed from a raspberry pi. You can get like 100 of them for $10 on amazon/ebay/etc.
It was late yesterday and I didn’t realize I made it sound scary! Yes to all you said! The heatsink is a great idea, too.