aboutsummaryrefslogtreecommitdiffstats
path: root/C++/TriangularDivisor.cpp
diff options
context:
space:
mode:
authorzedarider <ymherklotz@gmail.com>2016-02-26 21:15:09 +0000
committerzedarider <ymherklotz@gmail.com>2016-02-26 21:15:09 +0000
commitf7a1296d353dea1f98b47d4baef87426ceadf6b5 (patch)
treec4fc565b3e2f672647033d639601f695782f1562 /C++/TriangularDivisor.cpp
parentc2d76b36f9f2ef70de599add53c08a38af3d1760 (diff)
downloadimperial_2015-f7a1296d353dea1f98b47d4baef87426ceadf6b5.tar.gz
imperial_2015-f7a1296d353dea1f98b47d4baef87426ceadf6b5.zip
Organising into folders
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