OFFSET
1,1
EXAMPLE
a(1) = 4 because the next perfect power is 8 = 2^3, i.e., its exponent is > 2.
a(2) = 9: the exponents of the neighbors 8 = 2^3 and 16 = 2^4 are both > 2.
16 is not in the sequence because both neighboring perfect powers 9 = 3^2 and 25 = 5^2 have exponents 2.
Neighbors with exponents > 2 of the next terms: a(3) = 25 (16 = 2^3), a(4) = 27 (32 = 2^5), a(5) = 32 (27 = 3^3), a(6) = 36 (32 = 2^5), a(7) = 49 (64 = 2^6), a(8) = 64 (81 = 3^4).
PROG
(PARI) a340640(limit)={my(p2=999, p1=2, n2=1, n1=4); for(n=5, limit, my(p0=ispower(n)); if(p0>1, if(p2+p0>4, print1(n1, ", ")); n2=n1; n1=n; p2=p1; p1=p0))};
a340640(5000)
CROSSREFS
KEYWORD
nonn
AUTHOR
Hugo Pfoertner, Jan 14 2021
STATUS
approved