Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Project Euler

Name: Anonymous 2010-09-24 23:18

Hey /prog/, I know I'm a little late to the party, but I was wondering how many problems you've solved thus far.
Other discussion regarding Project Euler is also welcome!

Name: Anonymous 2010-09-24 23:35

Impromptu challenge proposal:

Solve a P.U. problem of your choice.

If the chosen problem has been solved previously in the thread, your solution must exceed all previous solutions in one or more aspects of: correctness, clarity, conciseness, elimination of redundant calculation.

Name: Anonymous 2010-09-25 13:53

>>2
1st Problem


#include <stdio.h>

main()
{
    float answer = 0;
    int i = 1;
   
    while (i < 1000)
    {
        labelA:
        if ((i%15) == 0)
        {answer+=i;
        i++;
        goto labelA;}
        if ((i%5) == 0)
        {answer+=i;}
        if ((i%3) == 0)
        {answer+=i;}
        i++;
    }
    printf("%f", answer);
    return 0;
}

Name: Anonymous 2010-09-25 16:12

>>2,12
Problem 1
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.

In[1]:= 3 Sum[d, {d, 1, 333}] + 5 Sum[i, {i, 1, 200}] - 15 Sum[x, {x, 1, 66}]
Out[1]= 234168

``faggot'' way

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List