MathGroup Archive 2005

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

Search the Archive

Re: Solving Diophantine Equations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61381] Re: Solving Diophantine Equations
  • From: "Diana" <diana53xiii at earthlink.remove13.net>
  • Date: Mon, 17 Oct 2005 02:29:49 -0400 (EDT)
  • References: <32592565.1129236555309.JavaMail.root@elwamui-darkeyed.atl.sa.earthlink.net> <9F2DCCEC-34BF-4F53-9475-F686A911F260@akikoz.net> <E39C9EDB-A88A-42F3-9AD9-7DA09C7D790A@yhc.att.ne.jp> <dio1s4$suo$1@smc.vnet.net> <diprnq$hn2$1@smc.vnet.net>
  • Reply-to: "Diana" <diana53xiii at earthlink.remove13.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Ray,

I am a beginning - intermediate Mathematica user.

The algorithm you and Andrzej have coded works great. Could I trouble you to 
explain briefly what the code is doing? To the un-initiated, the 
sophisticated code is hard to interpret.

As was mentioned in this thread, I am trying to corroborate the findings of 
Pingzhi Yuan in 2004.

I hope to use your improvements towards the equations of twenty other 
Diophantine equation articles, as well, for a thesis.

Thanks,

Diana

"Ray Koopman" <koopman at sfu.ca> wrote in message 
news:diprnq$hn2$1 at smc.vnet.net...
> Andrzej Kozlowski wrote:
>> That was wrong again! Trying to write these loops is so frustrating,
>> perhaps I should go back to functional programming... Anyway, I think
>> and hope this is now right at last:
>>
>> g[a_, b_, c_:5] := Block[{y, ls = {}, x, n},
>>     Do[ y = 2; While[(y^n - y^2)/((y - 1)*y) < a,
>>       Do[If[(x^3 - 1)/(x - 1) == (y^n - 1)/(y - 1) &&
>>            x != y, ls = {ls, {x, y, n}}],
>>          {x, y^((n - 1)/2), (y^n - y^2)/((y - 1)*y)}];
>>         y++], {n, c, b, 2}]; ls]
>>
>>
>> It is certainly not easy to find solutions, though, pretty big
>> searches so far have yielded just two, e.g.
>>
>> In[69]:=
>> g[100000,30]//Timing
>>
>> Out[69]=
>> {58.0157 Second,{{{},{5,2,5}},{90,2,13}}}
>>
>> [...]
>
> Procedural code such as this often benefits from the old
> standard tricks such as moving computations outside the loop
> and replacing division by multiplication.
>
> In[1]:=
> g[a_, b_, c_:5] := Block[{y, ls = {}, x, n},
> Do[y = 2;
>   While[(y^n - y^2)/((y - 1)*y) < a,
>         Do[If[(x^3 - 1)/(x - 1) == (y^n - 1)/(y - 1) && x != y,
>               ls = {ls, {x, y, n}}],
>            {x, y^((n - 1)/2), (y^n - y^2)/((y - 1)*y)}];
>         y++],
>   {n, c, b, 2}];
> ls]
>
> In[2]:=
> gg[a_, b_, c_:5] := Block[{y, x, n, r}, Reap[
> Do[y = 2;
>   While[y^(n-1) - y < (y - 1)a,
>         r = (y^n - 1)/(y - 1);
>         Do[If[x != y && (x+1)x+1 == r, Sow[{x, y, n}]],
>            {x, y^((n-1)/2), (y^(n-1) - y)/(y - 1)}];
>         y++],
>   {n, c, b, 2}]][[2,1]]]
>
> In[3]:= g[10^5,30]//Timing
>       gg[10^5,30]//Timing
>
> Out[3]= {30.28 Second,{{{},{5,2,5}},{90,2,13}}}
> Out[4]= {11.09 Second,{{5,2,5},{90,2,13}}}
> 


  • Prev by Date: Re: formatting table with integers and floats in a column
  • Next by Date: Re: Getting a pure text widget?
  • Previous by thread: Re: Solving Diophantine Equations
  • Next by thread: Re: Solving Diophantine Equations