aboutsummaryrefslogtreecommitdiff
path: root/Puzzle23translation.md
diff options
context:
space:
mode:
Diffstat (limited to 'Puzzle23translation.md')
-rw-r--r--Puzzle23translation.md51
1 files changed, 51 insertions, 0 deletions
diff --git a/Puzzle23translation.md b/Puzzle23translation.md
new file mode 100644
index 0000000..018e129
--- /dev/null
+++ b/Puzzle23translation.md
@@ -0,0 +1,51 @@
+Translation from the assembly code to pseudocode:
+
+'''
+b = 105700
+c = 122700
+
+for b = 105700, 105717, .., 122683
+ f = 1
+ for d = 2 .. b
+ for e = 2 .. b
+ if d * e == b then f = 0
+ if f == 0 then h += 1
+return h
+'''
+
+The original assembly code:
+
+'''
+set b 57
+set c b
+jnz a 2
+jnz 1 5
+mul b 100
+sub b -100000
+set c b
+sub c -17000
+set f 1
+set d 2
+set e 2
+set g d
+mul g e
+sub g b
+jnz g 2
+set f 0
+sub e -1
+set g e
+sub g b
+jnz g -8
+sub d -1
+set g d
+sub g b
+jnz g -13
+jnz f 2
+sub h -1
+set g b
+sub g c
+jnz g 2
+jnz 1 3
+sub b -17
+jnz 1 -23
+'''