Problem: Find the sum of all numbers below 1000 which are a multiple of 3 or 5.
Solution: Given the numbers involved, we can simply brute-force the answer by simply checking each number below 1000 for divisibility by 3 or 5 and keep a running total.
<?php declare(strict_types=1); error_reporting(E_ALL); $sum = 0; for ($num = 1; $num < 1000; $num++) { if ($num % 3 === 0 || $num % 5 === 0) { $sum += $num; } } print("$sum\n");