What kind of help do you expect?
This is from a mathematical point of view a huge linear equation system [imath] \mathbf{A\cdot x=b} [/imath] with a sparse matrix [imath] \mathbf{A} [/imath] with [imath] 0,1 [/imath] as matrix entries that has to be inverted. IIRC there are specific algorithms that deal with such problems.
The intention of such puzzles is to find a solution by trial and error. This can hardly be done on the internet. I would start with the lowest numbers [imath] 5,6,7[/imath] and [imath] 8 [/imath] but already these result in a variety of possibilities. Better use a pencil.