Powers
We define an important power as a number that can be represented as \$ x^y \$ where \$ x ≥ 2 \$ and \$ y ≥ 2 \$.
Palindrome
We define an important palindrome as a number that is the same written forwards and backward, and is greater than 10. Thus, the last digit must not be 0.
Palindromic Power
We define a Palindromic Power as a number that is both an important palindrome and important power.
Example
My reputation when I first drafted this question was 343, which was an important power as \$ 343 = 7^3 \$. It is also an important palindrome. Thus it is a palindromic power. (Interestingly, the number of badges I have when I first drafted this question was 7).
Your Challenge
Given an integer \$ n \$, print all palindromic powers that are less than (and not equal to) \$ n \$.
Example Program
Your program should produce the same output as this program. The exact order of your answer does not matter
from math import log def is_power(n, base): return not n%base and is_power(int(n//base), base) def is_important_power(n): for base in range(2, int(n**0.5) + 1): if is_power(n, base): return True return False def is_important_palindrome(n): s = str(n) return s == s[::-1] and n>10 def is_palindromic_power(n): return is_important_power(n) and is_important_palindrome(n) def main(number): final = [] for i in range(1, number): if is_palindromic_power(i): final.append(i) return final These are the palindromic powers under 1000000:
121 343 484 676 1331 10201 12321 14641 40804 44944 69696 94249 698896 Input
You may assume the input is under 100000000.
Scoring
This is code-golf.
logand theis_integercheck \$\endgroup\$