summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--problem1.ijs2
-rw-r--r--problem2.ijs11
2 files changed, 12 insertions, 1 deletions
diff --git a/problem1.ijs b/problem1.ijs
index 71227e8..19dff8b 100644
--- a/problem1.ijs
+++ b/problem1.ijs
@@ -1,4 +1,4 @@
nums =. i. 1000
mult3s =: 0=3|nums
mult5s =: 0=5|nums
-problem1 =: +/(mult3s +. mult5s)#nums \ No newline at end of file
+problem1 =: +/(mult3s +. mult5s)#nums
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