git://git.cassowary.me
/
sarabande.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f8ac77c
)
project euler 02
author
cassowarii
<cassowary@cassowary.me>
Tue, 7 Jul 2026 21:56:07 +0000
(14:56 -0700)
committer
cassowarii
<cassowary@cassowary.me>
Tue, 7 Jul 2026 21:56:07 +0000
(14:56 -0700)
sample/project_euler/pe02.sa
[new file with mode: 0644]
patch
|
blob
diff --git a/sample/project_euler/pe02.sa
b/sample/project_euler/pe02.sa
new file mode 100644
(file)
index 0000000..
0b7ae20
--- /dev/null
+++ b/
sample/project_euler/pe02.sa
@@ -0,0
+1,20
@@
+let next_fibonacci = (=> {
+ let fib_a = 0
+ let fib_b = 1
+ return => {
+ let temp = fib_a
+ fib_a = fib_b
+ fib_b = fib_b + temp
+ fib_b
+ }
+})()
+
+let accumulator = 0
+
+let f = 0
+while f < 4_000_000 {
+ f = next_fibonacci()
+ accumulator = accumulator + f if f %% 2
+}
+
+accumulator