On Tue, 15 Jun 2010 at 10:58AM +0530, Santanu Sarkar wrote: > Is there any function by which we can decide a positive integer X, > is a perfect cube or not i.e., weather there is an integer Y such that > > Y^3=X?
There is probably a much better way, but you can get the exponents of the prime factorization and check if they're divisible by 3: sage: x = 8 sage: list(x.factor()) [(2, 3)] sage: all(e % 3 == 0 for p, e in x.factor()) True sage: x = 10 sage: all(e % 3 == 0 for p, e in x.factor()) False Dan -- --- Dan Drake ----- http://mathsci.kaist.ac.kr/~drake -------
signature.asc
Description: Digital signature
