There are 123456789 nine numbers, each number can only be filled once, there are 3×3 grids, and the sum of each row, each vertical row and each oblique row is equal to 15. The answer is this:
I happen to have written a typical knapsack algorithm. Do you think it can be used?
After processing the results, you should be able to get the results you want.