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

Working with large numbers

Name: Anonymous 2010-09-27 19:45

I'm creating a program in C that factors a really, really large number(600851475143). What data type should I be using?
Also, my compiler told me that I cannot use the modulus operator with the previously stated number and long type number. How do I fix this?

Name: Anonymous 2010-09-28 10:41

>>6
FUCK YOU

#include <stdio.h>
#include <low_primes.h> //Adds an array of primes (long) low_primes[];

main()
{
    long factors[40];
    long long number = 600851475143LL;
    int i = 0;
    int n = 0;
   
    while (low_primes[i] != 99991)
    {
        if(number%low_primes[i] == 0)
        {
            factors[i] = low_primes[i];
            number/=low_primes[i];
        }
        if(number == 1 | number == 0)
        {

            while (n < 40)
            {
                printf("%l", factors[n]);
                n++;
            }
            break; // BECAUSE FUCK YOU GOTO
                   // PIG DISGUSTING!!!

        }
        i++;
    }
//  BREAK:
//      while (n < 40)
//      {
//          printf("%l", factors[n]);
//          n++;
//      }
    return 0;
}

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