diff options
author | zedarider <ymherklotz@gmail.com> | 2016-02-24 01:12:05 +0000 |
---|---|---|
committer | zedarider <ymherklotz@gmail.com> | 2016-02-24 01:12:05 +0000 |
commit | 08fdf56e21bcd9fe77508e98c9f65b9847d538ac (patch) | |
tree | 0fa4a49c7e796f3bff3729204249087e13e1012e /TriangularDivisor.cpp | |
download | imperial_2015-08fdf56e21bcd9fe77508e98c9f65b9847d538ac.tar.gz imperial_2015-08fdf56e21bcd9fe77508e98c9f65b9847d538ac.zip |
final changes to game done
Diffstat (limited to 'TriangularDivisor.cpp')
-rw-r--r-- | TriangularDivisor.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/TriangularDivisor.cpp b/TriangularDivisor.cpp new file mode 100644 index 0000000..4e1278c --- /dev/null +++ b/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 |