diff options
author | zedarider <ymherklotz@gmail.com> | 2016-02-26 21:15:09 +0000 |
---|---|---|
committer | zedarider <ymherklotz@gmail.com> | 2016-02-26 21:15:09 +0000 |
commit | f7a1296d353dea1f98b47d4baef87426ceadf6b5 (patch) | |
tree | c4fc565b3e2f672647033d639601f695782f1562 /C++/TriangularDivisor.cpp | |
parent | c2d76b36f9f2ef70de599add53c08a38af3d1760 (diff) | |
download | imperial_2015-f7a1296d353dea1f98b47d4baef87426ceadf6b5.tar.gz imperial_2015-f7a1296d353dea1f98b47d4baef87426ceadf6b5.zip |
Organising into folders
Diffstat (limited to 'C++/TriangularDivisor.cpp')
-rw-r--r-- | C++/TriangularDivisor.cpp | 29 |
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 |