aboutsummaryrefslogtreecommitdiffstats
path: root/C++/TriangularDivisor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'C++/TriangularDivisor.cpp')
-rw-r--r--C++/TriangularDivisor.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/C++/TriangularDivisor.cpp b/C++/TriangularDivisor.cpp
new file mode 100644
index 0000000..4e1278c
--- /dev/null
+++ b/C++/TriangularDivisor.cpp
@@ -0,0 +1,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;
+ }
+ }
+} \ No newline at end of file