Factors of an integer: Difference between revisions
Content added Content deleted
m (J: explain what was called "simple" because mechanical simplicity does not mean people will automatically understand it) |
|||
Line 2,668: | Line 2,668: | ||
└─────┴───┴───┴───┘</lang> |
└─────┴───┴───┴───┘</lang> |
||
From here, it's a simple matter (<code>*/&>@{</code>) to compute all possible factors of the original number |
From here, it's a simple matter (<code>*/&>@{</code> or, find all possible combinations of one item from each list (<code>{</code> without a left argument) then unpack each list and multiply its elements) to compute all possible factors of the original number |
||
<lang J>factrs=: */&>@{@((^ i.@>:)&.>/)@q:~&__ |
<lang J>factrs=: */&>@{@((^ i.@>:)&.>/)@q:~&__ |
||
factrs 40 |
factrs 40 |