C#:找到"酷"数字时答案错误

use*_*484 0 c#

在我的应用程序中,"酷"数字是一个正方形和一个立方体的数字,例如:64 = 8 ^ 2和64 = 4 ^ 3.我的应用程序应该在用户给出的范围之间找到"酷数"的数量.我写了我的代码,应用程序运行正常,但它给了我错误的答案.你能来帮我吗?例如:

INPUT

1 100

OUTPUT

1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            double a = Convert.ToDouble(Console.ReadLine()); // first number in the range
            double b = Convert.ToDouble(Console.ReadLine()); // second number in the range
            long x = 0;
            for (double i = a; i <= b; i++)
            {   

                   double cube = 1.0 / 3.0;
                   double cuad = 1.0 / 2.0;
                   double crt = Math.Pow(i, cube); // cube root 
                   double sqrt = Math.Pow(i, cuad); // square root


                if ((crt * 10) % 10 == 0 || (sqrt * 10) % 10 == 0) // condition to determine if it is a cool number.
                    x++;

            }
            Console.WriteLine(x);
            Console.ReadLine();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Eri*_*ert 11

"酷数字"是描述第六种力量的一种相当迂回的方式.显然,每六个功率都很酷; x ^ 6是(x ^ 2)^ 3和(x ^ 3)^ 2.每一个不是第六种力量的数字都不是很酷的数字.(证明留作练习.提示:考虑一个很酷的数字的任何素因数分解的必要属性.)

因此,我只想编写一个枚举范围内第六个幂的设备.