Ok, there is a solution to do it. My wife and i worked this out over pancakes for breakfast.
Unfortunately it's kind of slow.
There are four situations you need to determine, and the equation is different for each.
1. AOB is port, and periscope angle is less than 180
Target course = heading + periscope angle + AOB -180
2. AOB is starboard, periscope angle less than 180
Target course = heading + 180 + periscope angle -AOB
3. AOB is port, and periscope angle is greater than 180
Target course = heading + periscope angle + AOB - 180
4. AOB is starboard, and periscope angle is greater than 180
Target course = heading + periscope angle - AOB -180
e.g. heading 240, scope angle 90, AOB starboard 60, use equation 2
240+ 180 + 90 - 60 = 090
Someone please check the solutions, right now i'm a bit surprised that equations 1 and 3 are the same. EDIT - I've tested them and they all seem to be correct
But you can see right away why the real submarines used a whiz wheel for this