On Tue, Oct 21, 2014 at 3:46 PM, 'Pascal Jasmin' via Programming
<[email protected]> wrote:
> I don't completely understand number of divisors, but note:
>
> */@:(>:@{:)"2@(__&q:) 30
> 8
> q: 30
> 2 3 5
Here are the numbers which are divisors of 30:
,*/@>{1&,&.>q:30
1 5 3 15 2 10 6 30
(You might want to sort them.)
> I don't know why number of divisors of 39 would not be 3. Though I guess
the divisors are 1 2 3 5 6 10 15 30
Um... yes. I think, if I have interpreted what you wrote correctly enough
to understand what you are asking. In other words:
/:~,*/@>{1&,&.>q:30
1 2 3 5 6 10 15 30
/:~,*/@>{1&,&.>q:39
1 3 13 39
That said, the number of prime divisors of 30 is indeed 3.
> So, your d function looks like it should be efficient as long as __ & q:
is comparable in speed to just q:
>
> */@:(>:@{:)"2@(__&q:) 105600
> 96
>
> If not, there is this alternative basis for d:
>
> */ >: #/.~ q: 105600
> 96
*/@:(>:@{:)"2@(__&q:) 1+i.20
1 2 2 3 2 4 2 4 3 4 2 6 2 4 4 5 2 6 2 6
*/ >: #/.~ q: 1+i.20
1048576
The point of that suggestion was to eliminate the use of "0 from the
calculation.
Thanks,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm