tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
12
Task/Prime-decomposition/OCaml/prime-decomposition.ocaml
Normal file
12
Task/Prime-decomposition/OCaml/prime-decomposition.ocaml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
open Big_int;;
|
||||
|
||||
let prime_decomposition x =
|
||||
let rec inner c p =
|
||||
if lt_big_int p (square_big_int c) then
|
||||
[p]
|
||||
else if eq_big_int (mod_big_int p c) zero_big_int then
|
||||
c :: inner c (div_big_int p c)
|
||||
else
|
||||
inner (succ_big_int c) p
|
||||
in
|
||||
inner (succ_big_int (succ_big_int zero_big_int)) x;;
|
||||
Loading…
Add table
Add a link
Reference in a new issue