I was teaching indices chapter to my brother when I got this idea to find the number of numbers which are perfect squares as well as perfect cubes. I was wondering whether there is an algorithm to find these numbers between a fixed range like between $0$ and $100$. One number that can be thought of belonging to this category is 64,it as the cube of 4 and square of 8.
Asked
Active
Viewed 1,322 times
2 Answers
2
You do know that being a square and a cube is equivalent to being a sixth power, don't you? The number of sixth powers up to (and including) $n\ge 0$ is $1+\lfloor\sqrt[6]n\rfloor$, hence the number of sixth powers between $a$ and $b$, inclusive (with $0<a\le b$), is $\lfloor\sqrt[6] b\rfloor - \lfloor\sqrt[6] {a-1}\rfloor$
Hagen von Eitzen
- 374,180
-
1you know what i am exhilarated by your explanation that is exactly the same answer i was looking for.i reached upto the sixth powers step but i went clueless after that. how did you derive that formula can you explain it for me please.i would deeply appreciate that.thanks for the answer – 0decimal0 Jun 15 '13 at 11:38
-
If $n=m^6$, then $0^6,1^6,2^6,...,m^6$ are all sixth powers, and there are m+1 of them. If $n$ is not a sixth power, but it's greater than $m^6$, then the number of sixth powers up to and including $n$ are those same m+1 powers. Since $m^6\le n$ in both cases, we have $m\le\sqrt[6]{n}$, and the $1+\lfloor \sqrt[6]{n}\rfloor$ formula for "sixth powers no greater than $n$" is correct. Then, to get the sixth powers between $a$ and $b$ inclusive we take a difference, but if $a$ happens to be a sixth power, we wouldn't be counting it this way, so the formula Hagen provided uses $a-1$ and not $a$. – Mark S. Jun 27 '13 at 12:13
0
You can use some programming languages to find the solution given that the range is not so huge. I recommend sagemath, it is a PYTHON like opensource tool.
Another way you may want to construct these results: the sixth power of p: p^6 is both a cube and a square.
eccstartup
- 1,126
-
p^6 is a good result,whatever number we put in there will yield the result definitely but i guess we are not talking about doing things manually here. i mean can we design an algorithm for that purpose. to implement in any programming language we need to first find the algorithm of course – 0decimal0 Jun 15 '13 at 11:17
-
It is not hard to find the square root and cubic root of a number, I suppose. You can check whether the
rootis an integer, or just trunk therootand check if the square and the cubic are both equal the original number. – eccstartup Jun 15 '13 at 11:27