Problem 1 - Add all the natural numbers below one thousand that are multiples of 3 or 5

// May 26th, 2009 // Project Euler

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

2 Responses to “Problem 1 - Add all the natural numbers below one thousand that are multiples of 3 or 5”

  1. Scott Weaver says:

    <?php

    $y = array();

    for($i=1;$i<1001;$i++) if (!($i%3)||!($i%5)) $y[] = $i;

    $z = implode(”,”, $y);

    printf(”%s”, $z);

  2. tonieS says:

    HI AND THANKS

Leave a Reply