Special divisors: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
Drkameleon (talk | contribs) (added Arturo) |
||
Line 221: | Line 221: | ||
{{output}} |
{{output}} |
||
<syntaxhighlight lang="applescript">{|count|:72, finds:{1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 17, 19, 22, 23, 26, 27, 29, 31, 33, 37, 39, 41, 43, 44, 46, 47, 53, 55, 59, 61, 62, 66, 67, 69, 71, 73, 77, 79, 82, 83, 86, 88, 89, 93, 97, 99, 101, 103, 107, 109, 113, 121, 127, 131, 137, 139, 143, 149, 151, 157, 163, 167, 169, 173, 179, 181, 187, 191, 193, 197, 199}}</syntaxhighlight> |
<syntaxhighlight lang="applescript">{|count|:72, finds:{1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 17, 19, 22, 23, 26, 27, 29, 31, 33, 37, 39, 41, 43, 44, 46, 47, 53, 55, 59, 61, 62, 66, 67, 69, 71, 73, 77, 79, 82, 83, 86, 88, 89, 93, 97, 99, 101, 103, 107, 109, 113, 121, 127, 131, 137, 139, 143, 149, 151, 157, 163, 167, 169, 173, 179, 181, 187, 191, 193, 197, 199}}</syntaxhighlight> |
||
=={{header|Arturo}}== |
|||
<syntaxhighlight lang="arturo">reversed: function [x]-> |
|||
to :integer join to [:string] reverse digits x |
|||
specialDivisors: select 1..200 'n -> |
|||
every? factors n 'd -> |
|||
zero? (reversed n) % reversed d |
|||
loop split.every: 9 specialDivisors 'x -> |
|||
print map x 's -> pad to :string s 4</syntaxhighlight> |
|||
{{out}} |
|||
<pre> 1 2 3 4 5 6 7 8 9 |
|||
11 13 17 19 22 23 26 27 29 |
|||
31 33 37 39 41 43 44 46 47 |
|||
53 55 59 61 62 66 67 69 71 |
|||
73 77 79 82 83 86 88 89 93 |
|||
97 99 101 103 107 109 113 121 127 |
|||
131 137 139 143 149 151 157 163 167 |
|||
169 173 179 181 187 191 193 197 199</pre> |
|||
=={{header|BASIC}}== |
=={{header|BASIC}}== |