Maybe the best use of his time would be to develop math skills. Probability, Statistics, Calculus, Logic, perhaps a focus on algorithms (as you suggest) will give a leg up in important areas of computer science and make it much easier to jump in and do meaningful work when your friend gets out. Also all those skills do not require a computer to develop - although they are challenging. I hope there is some sort of support available in his current institution.