Essentially what I am looking for here is all the possible combinations of
the prime factors.
In this case I wouldn't use recursion. Instead use e.g. powerset:
poset=: (],,&.>)/@(<@,:"_1,a:"_) (see also:
http://www.jsoftware.com/jwiki/Essays/Power%20Set )
~. poset q: 60
┌┬─┬─┬───┬─┬───┬───┬─────┬───┬─────┬─────┬───────┐
││5│3│3 5│2│2 5│2 3│2 3 5│2 2│2 2 5│2 2 3│2 2 3 5│
└┴─┴─┴───┴─┴───┴───┴─────┴───┴─────┴─────┴───────┘
If you mean divisors have a look at
http://www.jsoftware.com/jwiki/Essays/Divisors
div 60
1 2 3 4 5 6 10 12 15 20 30 60
or with poset
/:~ */&> ~. poset q: 60
1 2 3 4 5 6 10 12 15 20 30 60
--
Met vriendelijke groet,
@@i = Arie Groeneveld
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm