Add tags

Add tags to the following comment
MLtonでコンパイルして、符号無し32bit整数までで約2時間40分。64bitでは834174年。遅すぎですね。

  mlton meertes.sml
  ./meertes 4294967295
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
fun goedel n = let
  open IntInf

  val p = [
     2,  3,  5,  7, 11, 13, 17, 19, 23, 29,
    31, 37, 41, 43, 47, 53, 59, 61, 67, 71
    ]
  val a = map (valOf o Int.fromString o str) ((explode o toString) n)
in
  ListPair.foldl (fn (x, y, z) => pow (x, y) * z) 1 (p, a)
end

fun meertens n = let
  fun loop i =
    if i > n then ()
    else
      if goedel n = n then (print (IntInf.toString n ^ "\n"); loop (i + 1))
      else loop (i + 1)
  in
    loop 0
  end

val _ = (meertens o valOf o IntInf.fromString o hd o CommandLine.arguments) ()

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...