(define *primes* '(2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97))
(define (meertens? num)
(define (meertens n)
(let ((numlist (number->list n)))
(apply * (map expt *primes* numlist))))
(= (meertens num) num))
(define (number->list n :optional (k (if (= n 1000) 3 (truncate (log n 10)))))
; (log 1000 10)が2.9999999999999996で切り捨てだと3に成らないため
(let loop ((keta k) (result '()) (m n))
(if (< keta 0)
(reverse result)
(let ((tani (expt 10 keta)))
(loop (- keta 1)
(cons (inexact->exact (quotient m tani)) result)
(- m (* (quotient m tani) tani)))))))
(meertens? 81312000)
KGRlZmluZSAqcHJpbWVzKiAnKDIgMyA1IDcgMTEgMTMgMTcgMTkgMjMgMjkgMzEgMzcgNDEgNDMgNDcgNTMgNTkgNjEgNjcgNzEgNzMgNzkgODMgODkgOTcpKQoKKGRlZmluZSAobWVlcnRlbnM/IG51bSkKICAoZGVmaW5lIChtZWVydGVucyBuKQogICAgKGxldCAoKG51bWxpc3QgKG51bWJlci0+bGlzdCBuKSkpCiAgICAgIChhcHBseSAqIChtYXAgZXhwdCAqcHJpbWVzKiBudW1saXN0KSkpKQogICg9IChtZWVydGVucyBudW0pIG51bSkpCgooZGVmaW5lIChudW1iZXItPmxpc3QgbiA6b3B0aW9uYWwgKGsgKGlmICg9IG4gMTAwMCkgMyAodHJ1bmNhdGUgKGxvZyBuIDEwKSkpKSkgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOyAobG9nIDEwMDAgMTAp44GMMi45OTk5OTk5OTk5OTk5OTk244Gn5YiH44KK5o2o44Gm44Gg44GoM+OBq+aIkOOCieOBquOBhOOBn+OCgQogIChsZXQgbG9vcCAoKGtldGEgaykgKHJlc3VsdCAnKCkpIChtIG4pKQogICAgKGlmICg8IGtldGEgMCkKCShyZXZlcnNlIHJlc3VsdCkKCShsZXQgKCh0YW5pIChleHB0IDEwIGtldGEpKSkKCSAgKGxvb3AgKC0ga2V0YSAxKSAKCQkoY29ucyAoaW5leGFjdC0+ZXhhY3QgKHF1b3RpZW50IG0gdGFuaSkpIHJlc3VsdCkgCgkJKC0gbSAoKiAocXVvdGllbnQgbSB0YW5pKSB0YW5pKSkpKSkpKQoKKG1lZXJ0ZW5zPyA4MTMxMjAwMCkK