Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
47
Task/Cuban-primes/Transd/cuban-primes.transd
Normal file
47
Task/Cuban-primes/Transd/cuban-primes.transd
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#lang transd
|
||||
|
||||
MainModule: {
|
||||
primes: Vector<ULong>([3, 5]),
|
||||
lim: 200,
|
||||
bigUn: 100000,
|
||||
chunks: 50,
|
||||
little: 0,
|
||||
c: 0,
|
||||
showEach: true,
|
||||
u: ULong(0),
|
||||
v: ULong(1),
|
||||
|
||||
_start: (λ found Bool() fnd Bool() mx Int() z ULong()
|
||||
(= little (/ bigUn chunks))
|
||||
(for i in Range(1 (pow 2 20)) do
|
||||
(= found false)
|
||||
(+= u 6) (+= v u) (= mx (to-Int (sqrt v) 1))
|
||||
(for item in primes do
|
||||
(if (> item mx) break)
|
||||
(if (not (mod v item)) (= found true)
|
||||
break))
|
||||
(if (not found)
|
||||
(+= c 1)
|
||||
(if showEach
|
||||
(= z (get primes -1))
|
||||
(while (< z (- v 2))
|
||||
(+= z 2) (= fnd false)
|
||||
(for item in primes do
|
||||
(if (> item mx) break)
|
||||
(if (not (mod z item)) (= fnd true)
|
||||
break))
|
||||
(if (not fnd) (append primes z)))
|
||||
(append primes v)
|
||||
(textout :width 11 :group v)
|
||||
(if (not (mod c 10)) (textout :nl))
|
||||
(if (== c lim) (= showEach false)
|
||||
(textout "Progress to the " :group bigUn
|
||||
"'th cuban prime:" ))
|
||||
)
|
||||
(if (not (mod c little)) (textout "."))
|
||||
(if (== c bigUn) break)
|
||||
)
|
||||
)
|
||||
(lout "The " :group c "'th cuban prime is " v )
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue