aboutsummaryrefslogtreecommitdiffstats
path: root/C++/TriangularDivisor.cpp
blob: 4e1278cfecc9ed367cbb9d71dd2123ee9e1e3006 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>

using namespace std;

int main() {
	int count, triangle, k, result;
	int* allcount = new int[100000000000];
	k = 0;
	result = 1;
	for(int i = 2; i < 50000; ++i) {
		triangle = (i*(i+1))/2;
		int realtriangle = triangle;
		for(int j = 2; j <= triangle; ++j) {
			count = 0;
			while(triangle % j == 0) {
				triangle /= j;
				++count;
			}
			allcount[k] = count;
			++k;
		}
		for(int j = 0; j < k; ++j) {
			result *= (allcount[j]+1);
		}
		if(result > 500) {
			cout << realtriangle << endl;
		}
	}
}