#include <iostream>
#include <math.h>
using namespace std;
long int GenerateTriangle(int n)
{
long int triangle = 0;
for(int i=1; i<=n; i++)
{
triangle+=i;
}
return triangle;
}
int CountDivisors(long int a)
{
int counter = 0;
for(int i=1; i<=sqrt(a); i++)
{
if(!(a%i))
counter++;
}
return counter*2;
}
int main()
{
for(long int i=0; i<80000; i++)
{
bool istrue = false;
if(CountDivisors(GenerateTriangle(i))>=500)
{
cout <<GenerateTriangle(i) << endl;
cout << CountDivisors(GenerateTriangle(i)) << endl;
cout<< endl;
istrue = true;
}
if(istrue)
break;
}
return 0;
}
Darmowy hosting zapewnia PRV.PL