Part 2 :
function solve($target, $limit = false) {
for ($i = 1; $i <= $target; $i++) {
for ($j = $i; $j <= ($limit ? min($limit * $i, $target) : $target); $j += $i) {
$houses[$j] = ($houses[$j] ?? 0) + $i;
}
}
foreach ($houses as $i => $presents) {
if ($presents >= $target) {
return $i;
}
}
}
// ==================================================
// > SOLUTIONS
// ==================================================
$solution_1 = solve($input->int / 10);
$solution_2 = solve($input->int / 11, 50);