I played around for a bit and can't find a simple answer to your question. Actually, I'm not surprised. Formulas are fairly limited in what they can see. I didn't find, for example, any way to work with indexes/subscripts or how to do looping and you'll need both for what you want to do
I think you'll have to combine some VBA to do the indirect stuff -- i.e. get the resource, get the task IDs that the resource is on, get each task, grab the value in Number1 and bring it back. And what about those occasions when the resource is on multiple tasks: which Number1 do you use?
The reverse (at a task and looking for Resource information) has similar issues.
The vba isn't rocket science and it sounds to me as if you know how to handle that.
Best I can suggest, then, is to use VBA to update (for example) Number2 and then use Number2 as one of the fields in the formula for Number1.