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-25 22:53

97

#include <iostream>

using namespace std;

int main()
{
    char number[10];
    for(int i = 0; i < 10;i++)
    {
        number[i] = 0;
    }
    number[9] = 2;
    for(int i = 0; i <7830457 - 1;i++)
    {
        for(int j = 9; j > -1;j--)
        {
            number[j] *=2;
        }
        for(int j = 9; j > -1;j--)
        {
            if(number[j] > 9)
            {
                number[j] -= 10;
                if( j != 0 )
                {
                    number[j-1]++;
                }
            }
        }
    }
    for(int i = 0; i < 10;i++)
    {
        cout << (int)number[i];
        // now use a calculator to multiply by 28433 and + 1
    }
}

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