Find all Super Powers A positive number is said to be super power when it is the power of at least two different positive integers. Write a program that lists all super powers in the interval [1, 264) (i.e. between 1 (inclusive) and 264 (exclusive)).

Sample Output

1
16
64
81
256
512
.
.
.
18443366605910179921
18444492376972984336
18445618199572250625


Constraints:


The program should not take more than 10 secs.
There are 67385 super powers below 264.
The shortest code wins.
Ruby, 97 93 characters

puts (r=2..32).map{|j|r.map{|i|(1..2**(64.0/j/i)).map{|a|a**(j*i)}}}.flatten.uniq.sort[0..-2]


I'm pretty sure this should be correct.

$ time ruby1.9 perfectpower.rb &gt; out

real    0m0.199s
user    0m0.160s
sys     0m0.030s

$ wc -l out
67385 out

$ head -6 out
1
16
64
81
256
512

$ tail -3 out
18443366605910179921
18444492376972984336
18445618199572250625