2020-09-21 10:45:06 +02:00
|
|
|
#!/usr/bin/env curly
|
2020-09-09 12:35:32 +02:00
|
|
|
>main
|
|
|
|
gto
|
|
|
|
:gcd
|
|
|
|
=v
|
|
|
|
=u
|
|
|
|
$u
|
|
|
|
$v
|
2020-09-11 12:59:18 +02:00
|
|
|
>gcd-loop
|
2020-09-09 12:35:32 +02:00
|
|
|
gge
|
|
|
|
$u
|
|
|
|
=t
|
|
|
|
$v
|
|
|
|
=u
|
|
|
|
$t
|
|
|
|
=v
|
2020-09-11 12:59:18 +02:00
|
|
|
:gcd-loop
|
2020-09-09 12:35:32 +02:00
|
|
|
$v
|
|
|
|
0
|
2020-09-11 12:59:18 +02:00
|
|
|
>gcd-ret
|
2020-09-09 12:35:32 +02:00
|
|
|
gle
|
|
|
|
$v
|
|
|
|
=t
|
|
|
|
$u
|
|
|
|
$v
|
|
|
|
mod
|
|
|
|
=v
|
|
|
|
$t
|
|
|
|
=u
|
2020-09-11 12:59:18 +02:00
|
|
|
>gcd-loop
|
2020-09-09 12:35:32 +02:00
|
|
|
gto
|
2020-09-11 12:59:18 +02:00
|
|
|
:gcd-ret
|
2020-09-09 12:35:32 +02:00
|
|
|
$u
|
|
|
|
ret
|
2020-09-12 18:31:58 +02:00
|
|
|
:lcm
|
|
|
|
=b
|
|
|
|
=a
|
|
|
|
$a
|
2020-09-14 09:23:40 +02:00
|
|
|
$a
|
2020-09-12 18:31:58 +02:00
|
|
|
$b
|
2020-09-09 12:35:32 +02:00
|
|
|
>gcd
|
|
|
|
fun
|
2020-09-12 18:31:58 +02:00
|
|
|
div
|
|
|
|
$b
|
|
|
|
mul
|
|
|
|
ret
|
|
|
|
:main
|
|
|
|
21
|
|
|
|
6
|
|
|
|
>lcm
|
|
|
|
fun
|
2020-09-21 10:45:06 +02:00
|
|
|
out
|
2020-09-09 12:35:32 +02:00
|
|
|
end
|