Magnanimous numbers: Difference between revisions
→{{header|Factor}}: replace with simpler, faster version
(→{{header|Factor}}: replace with simpler, faster version) |
|||
Line 177:
</pre>
=={{header|Factor}}==
{{trans|Julia}}
{{works with|Factor|0.99 2020-01-23}}
<lang factor>USING:
dup log10 >integer [1,b] [
10^ /mod + prime? not
] if ;
▲: (magnanimous?) ( str -- ? )
▲: magnanimous? ( str -- ? )
▲ dup length 1 = [ drop t ] [ (magnanimous?) ] if ;
: show ( seq from to -- ) rot subseq 15 group simple-table. nl ;
400 magnanimous
[ "First 45 magnanimous numbers" print 0 45 show ]
[ "241st through 250th magnanimous numbers" print 240 250 show ]
|