#C755. Determine if an Integer is a Perfect Power
Determine if an Integer is a Perfect Power
Determine if an Integer is a Perfect Power
Given an integer x, determine whether it can be expressed as a perfect power. In other words, check if there exist integers a > 1 and b > 1 such that \( x = a^b \). For example, 16 can be represented as \(2^4\) and 27 as \(3^3\), while 20 cannot be expressed in this form.
Your task is to write a program that reads an integer from standard input and prints True
if x is a perfect power, and False
otherwise.
inputFormat
The input consists of a single integer x (where x is non-negative).
outputFormat
Output a single line with either True
or False
indicating whether x is a perfect power.
16
True