-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample.txt
65 lines (64 loc) · 1.4 KB
/
sample.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
read n
cp := 2
do check n > 0
found := 0
cf1 := 2
cf1s := cf1 * cf1
do check cf1s <= cp
cf2 := 2
pr := cf1 * cf2
do check pr <= cp
if pr == cp
found := 1
fi
cf2 := cf2 + 1
pr := cf1 * cf2
od
cf1 := cf1 + 1
cf1s := cf1 * cf1
od
if found == 0
write cp
n := n - 1
fi
cp := cp + 1
od
$$
(program
[ (read "n")
(:= "cp" (num "2"))
(do
[ (check > (id "n") (num "0"))
(:= "found" (num "0"))
(:= "cf1" (num "2"))
(:= "cf1s" (* (id "cf1") (id "cf1")))
(do
[ (check <= (id "cf1s") (id "cp"))
(:= "cf2" (num "2"))
(:= "pr" (* (id "cf1") (id "cf2")))
(do
[ (check <= (id "pr") (id "cp"))
(if
(== (id "pr") (id "cp"))
[ (:= "found" (num "1"))
]
)
(:= "cf2" (+ (id "cf2") (num "1")))
(:= "pr" (* (id "cf1") (id "cf2")))
]
)
(:= "cf1" (+ (id "cf1") (num "1")))
(:= "cf1s" (* (id "cf1") (id "cf1")))
]
)
(if
(== (id "found") (num "0"))
[ (write (id "cp"))
(:= "n" (- (id "n") (num "1")))
]
)
(:= "cp" (+ (id "cp") (num "1")))
]
)
]
)