Taddeus Kroes 13 年 前
コミット
0a0036716e
1 ファイル変更24 行追加0 行削除
  1. 24 0
      problem46.py

+ 24 - 0
problem46.py

@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+from utils import primes_until
+
+MAX = 10000
+comps = [False] * MAX
+comps[1] = True
+
+for p in primes_until(MAX - 1):
+    q = 1
+    comps[p] = True
+
+    while True:
+        pplusq = p + 2 * q ** 2
+
+        if pplusq >= MAX:
+            break
+
+        comps[pplusq] = True
+        q += 1
+
+for i, passed in enumerate(comps):
+    if i & 1 and not passed:
+        print i
+        break