#!/usr/bin/php = MAX) { break; } foreach($primes as $middle) { $cube = $fourth + $middle ** 3; if ($cube >= MAX) { break; } foreach($primes as $inner) { $sum = $cube + $inner ** 2; if ($sum >= MAX) { break; } $sums[] = $sum; } } } echo "Found ".count(array_unique($sums))." numbers\n";