# [seqfan] Re: A079039(8), decreasing trunc(cosh(n))

Robert Gerbicz robert.gerbicz at gmail.com
Fri Jul 30 00:36:06 CEST 2010

```2010/7/29 Hagen von Eitzen <math at von-eitzen.de>

> On 28.07.2010 14:17, Richard Mathar wrote:
> > http://list.seqfan.eu/pipermail/seqfan/2010-July/005445.html responded
> >
> > zs>  Subject: [seqfan] Re: A079039(8), decreasing trunc(cosh(n))
> > zs>
> > zs>  1. Mmca code with 2000-digit accuracy gives:
> > zs>
> > zs>  (assuming that fractional part  of cos(0)=3D1
> > zs>  as  in  A079039)
> > zs>
> > zs>  1, 3, 22, 29, 45, 75, 135, 259, 863, 1786, 2483, 2538
> >
> > Indeed, confirmed. The cosh() grow large exponentially, and one has to
> turn
> > the number of digits higher with diligence for the followup terms to get
> > meaningful post-dot digits.
> >
> > RJM
> >
> >
> > _______________________________________________
> >
> > Seqfan Mailing list - http://list.seqfan.eu/
> >
> >
> >
>
> A few (very few) more:
>
> ? fy=1;b=1;for(n=1,100, while( (fb=frac(cosh(b))) >= fy, b++;
>
> default(realprecision,16);default(realprecision,floor(log(cosh(b))/log(10))+30);frac(cosh(b)));
> fy=fb; print1(b,", "); b++)
> 1, 3, 22, 29, 45, 75, 135, 259, 863, 1786, 2483, 2538, 5731, 16095,
>   *** cosh: user interrupt after 4mn, 52,910 ms.
>
> I think "near misses" can be excluded as replacing "fy=fb" in the code
> above with "fy=1.001*fb" produces the same result so far.
>
> And here are the correspondig fractional parts:
> 0.5430806348
> 0.0676619957
> 0.0657957809
> 0.0210371943
> 0.0173986167
> 0.0071713891
> 0.0058681139
> 0.0048040405
> 0.0007641272
> 0.0006658490
> 0.0006113271
> 0.0005632015
> 0.0001432333
> 0.0000518392
>
> So one might expect a new record after about 20000 more steps (i.e at
> about 35000)
>
> Hagen
>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>

There is a faster method to compute the sequence, doing only one
multiplication per n value:

allocatemem(10^8);iter=2000;rec=1.0;forstep(N=0,10^8,iter,
default(realprecision,floor(0.435*N+iter));c=exp(1);v=exp(N)/2;
for(i=1,iter,v*=c;if(frac(v)<rec,rec=frac(v);print1(N+i","))))

and it has given the next three terms also (after breaking the code):
1,3,22,29,45,75,135,259,863,1786,2483,2538,5731,16095,36692,94720,192897

cosh(n)=(exp(n)+exp(-n))/2, so in the code we can forget exp(-n), for not
very small n this is too small, but for n=3 this is still large and resulted
that the above code misses n=22.

```

More information about the SeqFan mailing list