Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: PE help
Date: Tue, 9 Nov 2010 02:34:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 28
Message-ID: <ibabus$eg6$1@fred.mathworks.com>
References: <iba7po$kd0$1@fred.mathworks.com> <ibaa8h$q5b$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1289270044 14854 172.30.248.35 (9 Nov 2010 02:34:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 9 Nov 2010 02:34:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1538946
Xref: news.mathworks.com comp.soft-sys.matlab:684960

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <ibaa8h$q5b$1@fred.mathworks.com>...
> "proecsm " <proecsm@gmail.com> wrote in message <iba7po$kd0$1@fred.mathworks.com>...
> > I am working on Project Euler #  55 and have code that give a 'tantilizingly' close answer to the generally accepted answer.  It matches the first 45 terms given in OEIS, but am wondering if I am missing something from the int2str conversions or precision issues. I am only missing a few terms...
> > 
> > <pre>
> > for n = 100:10000
> >     snum = int2str(n);
> >     c = 0;
> >     while ~all(snum-fliplr(snum)==0)
> >         
> >         c=c+1;
> >         snum = int2str(str2double(snum)+str2double(fliplr(snum)));
> >         
> >         if c > 50
> >             lychrel = [lychrel n]; %#ok<*AGROW>
> >             break
> >         end
> >     end
> > end
> > <\pre>
> - - - - - - - - - -
>   If you multiply 10000 * 2^50, that gives a number in the neighborhood of 1e19, and that lies beyond the range of integers that double can represent exactly.  You may have thought some of the numbers were not lychrel because of round off errors.
> 
> Roger Stafford

Thanks Roger, I will investigate using the symbolic toolbox or maple :(   If anyone knows of a longer list of (potential) lychrel numbers that I can compare my results to, I'd be interested.  I suspect they would be at the upper end of the range, however the number 89 (which I used for debug purposes) defies that assumption...

thanks for the help