Re: Find two numbers a,b such us: a+b=5432 & LCM[a,b]=223020
- To: mathgroup at smc.vnet.net
- Subject: [mg122161] Re: Find two numbers a,b such us: a+b=5432 & LCM[a,b]=223020
- From: Sseziwa Mukasa <mukasa at gmail.com>
- Date: Mon, 17 Oct 2011 08:09:50 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201110162045.QAA19688@smc.vnet.net>
On Oct 16, 2011, at 4:45 PM, dimitris wrote: > This is taken from the recent book (2010): " Mathematica: A Problem- > Centered Approach" by R. Hazrat. > > "The sum of two positive integers is 5432 and their least common > multiple is > 223020. Find the numbers." > > A solution: > > Do[If[LCM[i, 5432 - i] == 223020, Print[i, " ", 5432 - i]], {i, 1, > 2718}] > 1652 3780 > > I wonder if we can solve the system of equations: > > a+b==5432&&LCM[a,b]==223020 > > using codes that contain built in functions like Reduce. > > I guess this is not a trivial one because the so much powerful Reduce > itself fails > > In[1]:= Reduce[{a + b == 5432, LCM[a, b] == 223020}, {a, b}, Integers] > > During evaluation of In[1]:= Reduce::nsmet:This system cannot be > solved with the methods available to Reduce. >> > > Out[1]= Reduce[{a + b == 5432, LCM[a, b] == 223020}, {a, b}, Integers] > > Any ideas? There's probably an approach using DivisorSum but it's escaping me now. This brute force approach takes greater advantage of Mathematica's power to at least avoid checking values whose LCM is not 223020: Select[Subsets[Divisors[223020], 2], Total[#] == 5432 &][[1]] Regards, Ssezi
- References:
- Find two numbers a,b such us: a+b=5432 & LCM[a,b]=223020
- From: dimitris <dimmechan@yahoo.com>
- Find two numbers a,b such us: a+b=5432 & LCM[a,b]=223020