-
Notifications
You must be signed in to change notification settings - Fork 0
/
prima.tinl
96 lines (83 loc) · 1.67 KB
/
prima.tinl
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
(defun rem(a b)
(- a (* b (/ a b)))
)
(defun zequ(a b)
(- a b)
)
(defun deepdiv(num f)
(ifzero (rem num f)
(deepdiv (/ num f) (print f))
num
)
)
(defun factor1(num f0)
(let ((quotient0 (deepdiv num f0)))
(ifzero (zequ quotient0 1) 1
(print quotient0)
)
)
)
(defun factor2(num f0 f1)
(let ((quotient0 (deepdiv num f0)))
(ifzero (zequ quotient0 1) 1
(factor1 quotient0 f1)
)
)
)
(defun factor3(num f0 f1 f2)
(let ((quotient0 (deepdiv num f0)))
(ifzero (zequ quotient0 1) 1
(factor2 quotient0 f1 f2)
)
)
)
(defun factor4(num f0 f1 f2 f3)
(let ((quotient0 (deepdiv num f0)))
(ifzero (zequ quotient0 1) 1
(factor3 quotient0 f1 f2 f3)
)
)
)
(defun factor5(num f0 f1 f2 f3 f4)
(let ((quotient0 (deepdiv num f0)))
(ifzero (zequ quotient0 1) 1
(factor4 quotient0 f1 f2 f3 f4)
)
)
)
(defun factor6(num f0 f1 f2 f3 f4 f5)
(let ((quotient0 (deepdiv num f0)))
(ifzero (zequ quotient0 1) 1
(factor5 quotient0 f1 f2 f3 f4 f5)
)
)
)
(defun factor7(num f0 f1 f2 f3 f4 f5 f6)
(let ((quotient0 (deepdiv num f0)))
(ifzero (zequ quotient0 1) 1
(factor6 quotient0 f1 f2 f3 f4 f5 f6)
)
)
)
(defun factor8(num f0 f1 f2 f3 f4 f5 f6 f7)
(let ((quotient0 (deepdiv num f0)))
(ifzero (zequ quotient0 1) 1
(factor7 quotient0 f1 f2 f3 f4 f5 f6 f7)
)
)
)
(defun factor9(num f0 f1 f2 f3 f4 f5 f6 f7 f8)
(let ((quotient0 (deepdiv num f0)))
(ifzero (zequ quotient0 1) 1
(factor8 quotient0 f1 f2 f3 f4 f5 f6 f7 f8)
)
)
)
(defun factor10(num f0 f1 f2 f3 f4 f5 f6 f7 f8 f9)
(let ((quotient0 (deepdiv num f0)))
(ifzero (zequ quotient0 1) 1
(factor9 quotient0 f1 f2 f3 f4 f5 f6 f7 f8 f9)
)
)
)
(factor10 (readi32) 2 3 5 7 11 13 17 19 23 29)