# close form solution for A136010 (per PURRS http://www.cs.unipr.it/purrs/)

Joerg Arndt arndt at jjj.de
Sun Mar 30 00:32:24 CET 2008

```For those who want to refresh the basics about computations of
recurrences using matrix powers or (better!) powers modulo the
characteristic polynomial, Binet forms, recurrences for subsequences,
Binet forms etc., I dare to point to pp.655-665 of the text
http://www.jjj.de/fxt/#fxtbook
The stuff is written for programmers and hopefully accessible
for people without strong background in math.

Ralf Stephan's ggf (Guess Generating Function) script is
always handy, a copy is here:
http://www.jjj.de/pari/ggf.inc.gp

cheers,   jj  (feeling a bit like a spammer now)

* Max Alekseyev <maxale at gmail.com> [Mar 30. 2008 10:00]:
> On Sat, Mar 29, 2008 at 11:35 AM, Maximilian Hasler
> <maximilian.hasler at gmail.com> wrote:
>
> >  Maple:
> >  A136010:=n->simplify((10+61/sqrt(85))*(7/2-1/2*sqrt(85))^n+(10-61/sqrt(85))*(7/2+1/2*sqrt(85))^n);
> >
> >  PARI:
> >  A136010(n) = round((10+61/sqrt(85))*(7/2-1/2*sqrt(85))^n+(10-61/sqrt(85))*(7/2+1/2*sqrt(85))^n)
>
> The latter is not that good since sqrt() in PARI is not precise but
> floating-point function (in contrast to Maple, where it is symbolic by
> default). Therefore, this function may give wrong results for large n
> or an error like:
>
>   *** round: precision too low in truncr (precision loss in truncation).
>
> In PARI it is better to use the following code that does not involve
> any floating point operations:
>
> A136010(n) = local(y=Mod(x,x^2-85));
> lift((10+61/y)*(7/2-1/2*y)^n+(10-61/y)*(7/2+1/2*y)^n)
>
> Regards,
> Max

```