HACKER RANK Project Euler 63 - Powerful Digit Counts - Solution.'Py'

Project Euler Challenges-63 - Powerful Digit Counts Solution
Problem Statement
This problem is a programming version of Problem 63 from projecteuler.net
The 5digit number, 16807=75, is also a fifth power. Similarly, the 9-digit number, 134217728=89, is a ninth power.
Given N, print the Ndigit positive integers which are also an Nth power?
Input Format 
Input contains an integer N
Output Format 
Print the answer corresponding to the test case.
Constraints 
1N19
Sample Input
2
Sample Output
16
25
36
49
64
81

Solution:

a = input()
i = 1
j = 1
while (j < 10**a):
    j= i**a
    if (j>10**(a-1) and j<10**a):
        print j
    i+=1

Thanks for Visiting, Hope this helps you....

Comments

Popular Posts