problem5

地址:https://projecteuler.net/problem=5。
源码:git@code.aliyun.com:c-program/projecteuler.git。
问题:找到能整除1到20最小的数。

#include <stdio.h>#include <math.h>#include "elr_debug.h"#include "elr_list_int.h"#include "elr_prime.h"#define NUM 20int main(int argc, char **argv){    pIntNode tmpPrimeNode;    int i;    long int lResult = 1;    elrDebugTime(EDT_BEGIN);    initGlobalPrime();    if (NUM > globalPrimeNum)        isPrime(NUM);    tmpPrimeNode = globalPrime;    do{        if (NUM < tmpPrimeNode->data) break;        i = 1;        while (pow(tmpPrimeNode->data, i) < NUM)            i++;        lResult *= pow(tmpPrimeNode->data, i - 1);        tmpPrimeNode = tmpPrimeNode->next;    }while (globalPrime != tmpPrimeNode);        printf("Problem5  Answer: %ld\n", lResult);    freeGlobalPrime();        elrDebugTime(EDT_SPEND);    elrDebugTime(EDT_END);    return 0;}