summaryrefslogtreecommitdiff
path: root/Problem44.py
diff options
context:
space:
mode:
Diffstat (limited to 'Problem44.py')
-rw-r--r--Problem44.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Problem44.py b/Problem44.py
new file mode 100644
index 0000000..4824b01
--- /dev/null
+++ b/Problem44.py
@@ -0,0 +1,21 @@
+#Works, but is rather slow
+def Pentagon(n):
+ return n*((3*n)-1)/2
+pentagons = []
+for x in range(1,10000):
+ pentagons.append(Pentagon(x))
+count = 1
+run = True
+while (run):
+ for x in range(1,count+1):
+ if pentagons.count(pentagons[count] - pentagons[count-x]) >0 and pentagons.count(pentagons[count] + pentagons[count-x])>0:
+ print(pentagons[count],"|",pentagons[count - x], "\tDifference D is:", abs(pentagons[count] - pentagons[count-x]))
+ run = False
+ #print(pentagons[count] - pentagons[count-x])
+ count+=1
+ pentagons.append(Pentagon(count+9998))
+
+
+
+
+ \ No newline at end of file