For larger n, you may get a faster solution by generating all partitions p of m for which 2<+./p . The actual perfect power would be */p^p:i.#p
----- Original Message ----- From: Arie Groeneveld <[EMAIL PROTECTED]> Date: Sunday, January 27, 2008 3:42 Subject: [Jprogramming] Perfect powers To: Programming forum <[email protected]> > JATK or let's say J4F. > > Generating a sequence of ordered perfect powers <= N > ref. OLEIS A001597 > > I have a tacit (pmt) and a explicit (pmx) version both with the same > algorithm > > *nb* Without ext. prec. > > pmt 200 > 1 4 8 9 16 25 27 32 36 49 64 81 100 121 125 128 144 169 196 > > 10 ts 'pmt 2000000' > 0.006247 232448 > > 10 ts 'pmx 2000000' > 0.0036827 275712 > > > x:{: pmx 2e6 > 1999396 > > #pmt 1e6 NB. OLEIS A070428 > 1111 > > > Testing if a number > 1 is a perfect power: > > (1<[:+./[:{:__&q:) 220 > 0 > > (1<[:+./[:{:__&q:) 32 > 1 > > > Just anxious to know (JATK) what's possible. :-) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
