Super-d numbers: Difference between revisions

→‎{{header|Clojure}}: Add implementation
(→‎{{header|Clojure}}: Add implementation)
Line 425:
9: 17546133 32613656 93568867 107225764 109255734 113315082 121251742 175461330 180917907 182557181 275.4s</pre>
Slower than '''GMP''' on the core i7-7700 @ 3.6Ghz, over twice as slow. This one is 275 seconds, vs. 102 seconds for '''GMP'''.
 
=={{header|Clojure}}==
{{trans|Raku}}
A more naïve implementation inspired by the Raku one, but without its use of parallelism; on my somewhat old and underpowered laptop, it gets through the basic task of 2 through 6 in about 6 seconds, then takes almost 40 to complete 7, and several minutes for 8; I stopped waiting for 9 after 15 minutes.
 
<lang clojure>(defn super [d]
(let [run (apply str (repeat d (str d)))]
(filter #(clojure.string/includes? (str (* d (Math/pow % d ))) run) (range))))
 
(doseq [d (range 2 10)]
(println (str d ": ") (take 10 (super d))))</lang>
{{Out}}
<pre>2: (19 31 69 81 105 106 107 119 127 131)
3: (261 462 471 558 753 1046 1471 1645 1752 1848)
4: (1168 4972 7423 7752 8431 11317 11487 11549 11680 16588)
5: (4602 5517 7539 9469 12955 14555 20137 20379 26629 35689)
6: (223763 302693 323576 513675 678146 1183741 1324944 1523993 1640026 1756271)
7: (4258476 9438581 10900183 11497728 12380285 12834193 13658671 14290071 16034108 16046124)
8: (29242698 43307276 44263715 45980752 54555936 81044125 126984952 133579963 142631696 152390251)</pre>
 
=={{header|D}}==
1,480

edits