summaryrefslogtreecommitdiff
path: root/problem2.ijs
diff options
context:
space:
mode:
Diffstat (limited to 'problem2.ijs')
-rw-r--r--problem2.ijs11
1 files changed, 11 insertions, 0 deletions
diff --git a/problem2.ijs b/problem2.ijs
new file mode 100644
index 0000000..22e2061
--- /dev/null
+++ b/problem2.ijs
@@ -0,0 +1,11 @@
+fib =: 3 : 0 M. NB. M. means that it is memoized
+if. 1>:y do.
+ x: 1
+else.
+ (fib y-1)+fib y-2
+end.
+)
+
+fibs =: ; fib each i.50 NB. first 50 should be enough lol
+
+problem2 =: +/((0=2|fibs)*.(fibs<4000000))#fibs