Results 1 to 6 of 6

Math Help - Please help

  1. #1
    Junior Member
    Joined
    Apr 2005
    Posts
    26

    Please help

    Find the sum of all integers between 1 and 9999 that are divisible by 5 but not by 6 nor 7.

    Any help is greatly appreciated!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member
    Joined
    Apr 2005
    Posts
    103
    Answer is 7137125

    Matlab code:
    a = 0;
    for i = 1:9999
    if mod(i,5) == 0 && mod(i,6) ~= 0 && mod(i,7) ~= 0
    a = a + i;
    end
    end
    disp(a);
    Last edited by paultwang; May 10th 2005 at 11:09 PM.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    Apr 2005
    Posts
    26
    Is there a way of not using a calculater to work this out, in a logic way, by not also writing all the numbers out.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Junior Member
    Joined
    Apr 2005
    Posts
    26
    Quote Originally Posted by paultwang
    Answer is 7137125

    Matlab code:
    a = 0;
    for i = 1:9999
    if mod(i,5) == 0 && mod(i,6) ~= 0 && mod(i,7) ~= 0
    a = a + i;
    end
    end
    disp(a);
    Is there a way of not using a calculater to work this out, in a logic way, by not also writing all the numbers out.
    Reply With Quote
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Member
    Joined
    Apr 2005
    Posts
    103
    > 9999/5.;

    1999.8

    > 9999/30.;

    333.3000000

    > 9999/35.;

    285.6857143

    > 9999/210.;

    47.61428571

    > 1999*(1+1999)/2*5;
    9995000

    > 333*334/2*30;

    1668330

    > 285*286/2*35;

    1426425

    > 47*48/2*210;

    236880

    > 9995000-1668330-1426425+236880;


    7137125


    Thanks buggler@Undernet for the help on this method.
    Last edited by paultwang; May 25th 2005 at 08:20 AM.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Junior Member
    Joined
    Apr 2005
    Posts
    26

    Smile Thanks for the help

    Thanks for the help
    Follow Math Help Forum on Facebook and Google+


/mathhelpforum @mathhelpforum