Project Euler 题解 #63 Powerful digit counts

来源:互联网 发布:linux卸载scim 编辑:程序博客网 时间:2024/05/31 19:57

题目:Powerful digit counts

The 5-digit number, 16807=75, is also a fifth power. Similarly, the 9-digit number, 134217728=89, is a ninth power.

How many n-digit positive integers exist which are also annth power?

 

分析

假设一个位数为x的数S=kx,得到关系式:

 

右端可得:1<=k<=9

左端看得:k>=101-1/x,

题目的解就是统计满足上面不等式的k值的总数。

列图表解:

结果为49.

0 0