http://www.perlmonks.org?node_id=482012


in reply to Algorithm for cancelling common factors between two lists of multiplicands

The same exampled worked through:

  • @a = ( 10, 20, 33, 45, 60 );
  • @b = ( 2, 5, 10, 12, 16, 23, 45 );

    Eliminate common elements:

  • @a = ( 20, 33, 60 );
  • @b = ( 2, 5, 12, 16, 23 );

    Cancel 2 with 20 to give 1 and 10 (discard the 1):

  • @a = ( <strike>20</strike><ins>10</ins>, 33, 60 );
  • @b = ( <strike>2</strike><ins>1</ins>, 5, 12, 16, 23 );

    Cancel 5 with 10 to give 1 and 2:

  • @a = ( <strike>10</strike><ins>2</ins>, 33, 60 );
  • @b = ( <strike>5</strike><ins>1</ins>, 12, 16, 23 );

    Cancel 2 with 12 to give 1 and 6 (discard the 1 )

  • @a = ( 2, 33, 60 );
  • @b = ( 12, 16, 23 );

    Cancel 6 with 60 to give 1 and 10 (discard the 1 )

  • @a = ( 33, 60 );
  • @b = ( 6, 16, 23 );

    Cancel 16 with 10 to give 8 and 5

  • @a = ( 33, 10 );
  • @b = ( 16, 23 );

    Result: (Other reductions are possible!)

  • @a = ( 33, 5 );
  • @b = ( 8, 23 );

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.