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.
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.