So I guess the triple nested for loop won't work because they need to be obtained from a random draw and not sequentially? Have you heard of the randi() function?
Do you have to find them ALL? Since to make sure you've tested them all, and you're using randi() instead of a triple-for-loop, you're going to have to ask for lots of them. Let's see, a 100x100x100 would take a million test, so taking them randomly might take a few hundred million, which is certainly within MATLAB's power. Then use a single for loop to test them all
N = 200000000;
r = randi(...
for k = 1 : N
if r(1) + ...