Factorions: Difference between revisions
Content added Content deleted
m (used a bigger font for the equations.) |
(julia example) |
||
Line 200: | Line 200: | ||
</pre> |
</pre> |
||
=={{header|Julia}}== |
|||
<lang julia>isfactorian(n, base) = mapreduce(factorial, +, map(c -> parse(Int, c, base=16), split(string(n, base=base), ""))) == n |
|||
printallfactorian(base) = println("Factorians for base $base: ", [n for n in 1:100000 if isfactorian(n, base)]) |
|||
foreach(printallfactorian, 9:12) |
|||
</lang>{{out}} |
|||
<pre> |
|||
Factorians for base 9: [1, 2, 41282] |
|||
Factorians for base 10: [1, 2, 145, 40585] |
|||
Factorians for base 11: [1, 2, 26, 48, 40472] |
|||
Factorians for base 12: [1, 2] |
|||
</pre> |
|||
=={{header|OCaml}}== |
=={{header|OCaml}}== |