RosettaCodeData/Task/Home-primes/Transd/home-primes.transd
2023-07-01 13:44:08 -04:00

23 lines
689 B
Text

#lang transd
MainModule: {
homePrime: (λ i BigLong()
(if (is-prime i) (lout "HP" i " = " i) continue)
(with n BigLong(i) ch Vector<BigLong>() st 1
(append ch n)
(while true
(= n (join (prime-factors n) ""))
(append ch n)
(if (is-probable-prime n 15)
(for l in Range(in: ch 0 -1) do
(textout "HP" l "("(- (size ch) @idx 1) ") = "))
(lout (back ch)) (ret)
else (+= st 1))
)
)
),
_start: (λ
(for i in Range(2 21) do (homePrime BigLong(i)))
(homePrime BigLong(65))
)
}