Post Reply 
Massaging output of 50g's FACTORS command
01-03-2015, 05:32 PM (This post was last modified: 01-03-2015 05:38 PM by C.Ret.)
Post: #4
RE: Massaging output of 50g's FACTORS command
Hi, another way is to duplicate the list element by element into two distinct lists.
To separate factors from exponents, the process alternates the positions of the two lists during construction.
Code:
SPLIPT:
« { } DUP ROT 1      // Initiate exponent and factor lists and GETI sequence
  DO
     GETI            // Get i-th element
     5 ROLL +        // Roll down the exponent or the factors list & add the i-th ele.
     ROT ROT         // Roll back completed list in the "wrong" place (to alternate)
  UNTIL DUP 1 SAME   // loop until the entire inital list 
  END DROP2 »

The factors lsit { 3 5. 2 3.} will result in { 2 3 } and { 3. 5.} lists.
The list { y 5 p 1 p 0 a 2 H } will be split into the two lists 1:{ H a p p y } and 2:{ 2 0 15 }.
This last example is of course a season best greetings pretext.

So { y 5 p 1 p 0 a 2 H } SPLIT to everybody here !!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Massaging output of 50g's FACTORS command - C.Ret - 01-03-2015 05:32 PM



User(s) browsing this thread: 4 Guest(s)