Browse Source

Start a faster Lucas (doesn't work)

Petra Lamborn 5 years ago
parent
commit
8cab8d4223
1 changed files with 12 additions and 0 deletions
  1. 12
    0
      lucas.py

+ 12
- 0
lucas.py View File

@@ -119,5 +119,17 @@ def LucasVn(n, p, q):
119 119
     return Lucas(n, p, q)[1]
120 120
 
121 121
 
122
+def LucasFast(k, p, q, n):
123
+    if k < 0:
124
+        raise ValueError("k must be a non-negative integer")
125
+    if n < 1:
126
+        raise ValueError("n must be a postive integer")
127
+    uc, vc = Lucas(1, p, q)
128
+    dk = floor(log(k, 2))
129
+    tp = 2**dk
130
+    for i in range(dk):
131
+
132
+
133
+
122 134
 
123 135