[seqfan] Re: Next perfect power number?

Robert Gerbicz robert.gerbicz at gmail.com
Sun Jul 17 15:25:41 CEST 2016


2016-07-17 14:46 GMT+02:00 Zak Seidov <seqfan at list.seqfan.eu>:

>  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/
>

A polynomial time algorithm in Pari-Gp:

nextpp(n)={maxe=floor(log(n)/log(2)+2);
d=floor(log(n)/log(10)+5);
default(realprecision,d);
l=log(n+0.5);
for(e=2,maxe,g=ceil(exp(l/e));if(e==2||g^e<ret,ret=g^e));
default(realprecision,28);
return(ret)}



More information about the SeqFan mailing list