Project Euler #63: Powerful digit counts

Sort by

recency

|

45 Discussions

|

  • + 0 comments

    Simple solution in python:

    n=int(input().strip())
    i=1
    while True:
        p=pow(i,n)
        if len(str(p))==n:
            print(p)
        if len(str(p))>n:
            break
        i+=1
    
  • + 0 comments

    Scanner sc=new Scanner(System.in); int n=sc.nextInt(); if(n>0 && n<20){ for(int i=1;i<=19;i++){ int x=(int)Math.pow(i,n); // int y=n; //converted num into string to calculate the no of degits inside of the string
    String str=String.valueOf(x); if(str.length()==n){ System.out.println(x); }else if(str.length()

                    }
    
  • + 0 comments

    this could also be a good solution, easiest one in short of problems :') n = int(input()) a = 10 ** (n-1) b = 10 ** (n) k = int(math.ceil(pow(a, 1/n))) ans = 0 while(k ** n < b): ans += 1 print(k ** n) k += 1

  • + 0 comments

    Shortest code in the list of problems

    n=int(input())
    for x in range(2,11):
        if len(str(x**n))==n: print(x**n)
    
  • + 0 comments

    Shortest code in the list of problems

    n=int(input()) for x in range(2,11): if len(str(x*n))==n: print(x*n)