[seqfan] Re: Next perfect power number?

Zak Seidov zakseidov at mail.ru
Mon Jul 18 09:02:31 CEST 2016


 In "my" code, the most important (and wrong?) difference is in limit of k:
instead of RGW's code (which I didn't know):
{k, 2, 1 + Floor@ Log2@ n}
I arbitrarily used
{k, 2, m} with m=10 or 11
(which, supposedly, in most cases was sufficient for my purposes -
and may be I'm totally wrong:().
Zak



>Понедельник, 18 июля 2016, 9:06 +03:00 от Robert Gerbicz <robert.gerbicz at gmail.com>:
>
>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/
>>
>
>--
>Seqfan Mailing list -  http://list.seqfan.eu/



More information about the SeqFan mailing list