# [seqfan] Re: Next perfect power number?

Robert Gerbicz robert.gerbicz at gmail.com
Mon Jul 18 08:06:42 CEST 2016

```And how does your algorithm scale?
My algorithm finds nextpp(10^100)=(10^50+1)^2 in just 32 ms.
Btw my algorithm is similar to one Mathematica code in the sequence:
nextPerfectPower[n_] := If[n == 1, 4, Min@ Table[ (Floor[n^(1/k)] + 1)^k,
{k, 2, 1 + Floor@ Log2@ n}]];

2016-07-18 1:19 GMT+02:00 Zak Seidov <seqfan at list.seqfan.eu>:

>  Great!
> (The last) MMa in A001597 is similar
> to "my code" and even better.
> Thx,
> Zak
>
>
> >Воскресенье, 17 июля 2016, 16:51 +03:00 от "Harvey P. Dale" <
> hpd at hpdale.org>:
> >
> >Zak:
> >  Take a look at the last Mma program in A001597.
> >  Best,
> >  Harvey
> >
> >-----Original Message-----
> >From: SeqFan [mailto:seqfan-bounces at list.seqfan.eu] On Behalf Of Zak
> Seidov via SeqFan
> >Sent: Sunday, July 17, 2016 8:46 AM
> >To: Sequence Fanatics Discussion list < seqfan at list.seqfan.eu >
> >Cc: Zak Seidov < zakseidov at mail.ru >
> >Subject: [seqfan] Next perfect power number?
> >
> > Dear seqfans,
> >
> >Plz help with the best (fastest) code in PARI/Mma for finding ppn next to
> given n (which itself is ppn).
> >Interval between consecutive ppn's
> >generally increases and checking each n+1, n+2,... is very slow (for
> large n's).
> >
> >Thx, Zak
> >
> >--
> >Seqfan Mailing list -  http://list.seqfan.eu/
> >
> >--
> >Seqfan Mailing list -  http://list.seqfan.eu/
>
>
> --
> Seqfan Mailing list - http://list.seqfan.eu/
>
```