(I thought about what the job would mean and it's too long since I studied, I just don't have the math self confidence to go halfway around the planet for a job. To do the green card dance etc, I'd need to feel confident about job fit.)
Edit: Too late, will sleep now. I'll try to remember and check this if you answer, when I wake up.
Would have been slightly faster if I had thought less and brute forced a bit more. A crazy old friend used to say "Don't underestimate brute force and ignorance"! :-)
Wonder if anyone tried frequency analysis since that should work well on an affine transform...
I hope yummyfajitas posts some of the answers.
[edit] time for my part 1 solution was 7.8 seconds on an old Dell 2650
For part 1, with 'time' got real 0m2.865s, user 0m2.780s on a T60 Lenovo/"IBM". I used a few minutes to think about the brute force, which probably saved me half the execution time.
In pure percentage of loss/earn, those minutes for three seconds was probably the worst business of my life... :-) You can take the C/C++ compiler from the old nerd, but you can't stop him from doing premature optimization. :-)