Remember: Include and exclude!

How many integers from 1 1 to 1 0 6 10^6 (inclusive) are neither perfect squares nor perfect cubes nor perfect fourth powers?


The answer is 998910.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Phil Clifton
Oct 11, 2015

Of our 10^6 starting values... There are 1000 values that are perfect squares. (1^2 to 1000^2) There are 100 values that are perfect cubes, (1^3 to 100^3) however 10 of these [ a perfect square that is then cubed] can also be expressed as square numbers. For example 4^3 = (2^2)^3 = (2^3)^2 = 8^2 so need to be excluded from the count as it has already been included in the line above, leaving 90 perfect cubes that are not square. Though there are 31 perfect forth powers, (1^4 to 31^4), each of these can be expressed as a perfect square, previously accounted for; so need not be considered. eg 31^4 = (31^2)^2 < 961^2

From the 1,000,000 starting integers 1090 have been identified as powers of 2, 3, or 4 leaving 998910 integers that are therefore not powers of 2, 3 or 4.

10/10 solution

Zane Grube - 5 years, 8 months ago

Bingo! Great solution...

Aaryaman Gupta - 5 years, 8 months ago

First, count how many integer perfect squares, cubes and fourth powers are there between 1 and 1000000. Counting with Mathematica into three lists:

squares:= { } \text{squares}\text{:=}\{\}

cubes:= { } \text{cubes}\text{:=}\{\}

quadroes:= { } \text{quadroes}\text{:=}\{\}

For [ n = 1 , n 1 0 6 , n ++ , \text{For}\left[n=1,n\leq 10^6,n\text{++},\right.

k = n ; k=\sqrt{n};

l = n 3 ; l=\sqrt[3]{n};

m = n 4 ; m=\sqrt[4]{n};

If [ IntegerQ [ k ] = True , AppendTo [ squares , n ] ] ; \text{If}[\text{IntegerQ}[k]=\text{True},\text{AppendTo}[\text{squares},n]];

If [ IntegerQ [ l ] = True , AppendTo [ cubes , n ] ] ; \text{If}[\text{IntegerQ}[l]=\text{True},\text{AppendTo}[\text{cubes},n]];

If [ IntegerQ [ m ] = True , AppendTo [ quadroes , n ] ] ] \text{If}[\text{IntegerQ}[m]=\text{True},\text{AppendTo}[\text{quadroes},n]]]

Then, to count how many of the integers between 1 to 1000000 are neither perfect squares nor perfect cubes nor perfect fourth powers, substract the union of the lists "squares", "cubes" and "quadroes" from the total number of integers between 1 and 1000000:

1000000 Length [ squares cubes quadroes ] 1000000-\text{Length}[\text{squares}\cup \text{cubes}\cup \text{quadroes}] = 998910 \boxed{998910}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...