MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Some list questions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37158] Re: [mg37132] Some list questions
  • From: BobHanlon at aol.com
  • Date: Sun, 13 Oct 2002 05:57:13 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 10/12/2002 8:37:26 PM, flip at safebunch.com writes:

>I wanted to do list manipulation methods explicitly on the lists without
>using GCD and FactoInteger specifically.  I am doing things with numbers
>that I know the factorization for, but the methods in Mathematica (or anything
>else for that matter) don't suffice.
>
>Is there an easy way to get rid of the GCD and FactorInteger in the second
>method.
>

minInt[x_, y_] :=
    Select[Union[x, y],
        MemberQ[First /@ Intersection[x, y, 
                SameTest -> (#1[[1]] == #2[[1]] &)], #[[1]]] &] //.
      {s___, {b_, e1_}, {b_, e2_}, r___} :> 
        {s, {b, Min[e1, e2]}, r};

list1 = {{2, 3}, {3, 4}, {5, 6}, {7, 2}, {17, 5}};
list2 = {{2, 5}, {3, 2}, {5, 1}, {7, 3}};

minInt[list1, list2]

{{2, 3}, {3, 2}, {5, 1}, {7, 2}}


Bob Hanlon


  • Prev by Date: Re: Table using as iterator a multiple of 10, 100, ...,10^n
  • Next by Date: Re: Complex numbers
  • Previous by thread: Some list questions
  • Next by thread: Re: Some list questions