# How many positive integers <= 1000000 are squares or cubes?

Hi,

I have been set some weird questions.

1. How many positive integers <= 1000000 are squares or cubes?

2. How many positive integers <=1000 include among their (base 10) digits a "5" or a "6"

3. How many solutions in positive integers are there to the equation
x + y + z = 2004?

Are there structured ways to answering these questions? Well obviously there must be, any idea what they are?
manps
Hi,

I have been set some weird questions.

1. How many positive integers <= 1000000 are squares or cubes?

...

Take the square root of 1000000 to give the number of integers whose square is <= 1000000.
Similarly for the cubed integers.
manps
2. How many positive integers <=1000 include among their (base 10) digits a "5" or a "6"

I'm taking this to mean any digit can be a 5 or 6. Just work it through systematically. I'd start with the largest digits first:
500-599 and 600-699 (2x100)
50-69, 150-169, 250-269, 350-369....950-969 (8x20)
5,6,15,16,25,26....95,96 (8x2x8)

Giving 200+160+128=488 positive integers with a 5 or 6 in their digits.
Fermat
Take the square root of 1000000 to give the number of integers whose square is <= 1000000.
Similarly for the cubed integers.

But couldn't there be a cube which is also a square? (eg. 1000000=1000^2=100^3). Surely you'd be counting these cases twice.
Fermat
Take the square root of 1000000 to give the number of integers whose square is <= 1000000.
Similarly for the cubed integers.

How would the square root iof 1000000 tell you the no. of integers that square <= 1000000? Is there like a proof?
manps

3. How many solutions in positive integers are there to the equation
x + y + z = 2004?

As x,y,z must all be positive integers then they must all be at least one.
Let x=2002. y=1, z=1.
Let x=2001. y=2, z=1 or y=1, z=2
Let x=2000. y=3, z=1 or y=2, z=2 or y=1, z=3
and so on with it increasing by one each time until:
x=1 in which case there are 2002 different pairs of values for y and z, as y can take 2002 different values with z making up the rest.

1+2+3+4....+2001+2002=(2002x2003)/2 (triangle numbers)

As x, y and z are interchangeable, then this process can be repeated but swapping y and then z for x, so there are 3 times as many combinations. Thus, the number of different ways is (3/2)x(2002x2003)=6015009.
2776
How would the square root iof 1000000 tell you the no. of integers that square <= 1000000? Is there like a proof?

Well, the square root of 1000000 is 1000. As no two square numbers can have the same value if their square roots are different, then there must be 1000 square numbers less than or equal to the square of 1000.
2776
How would the square root iof 1000000 tell you the no. of integers that square <= 1000000? Is there like a proof?

Think about it - if you sqrt (or whatever-root) a number, all numbers less than the root will square (or whatever) to be less than the original number. Try it with 100: it's obvious that there are 10 integers whose squares are <= 100. 10, and any integer less than 10.

Ben
Ben.S.
Think about it - if you sqrt (or whatever-root) a number, all numbers less than the root will square (or whatever) to be less than the original number. Try it with 100: it's obvious that there are 10 integers whose squares are <= 100. 10, and any integer less than 10.

Ben

ditto.
meepmeep
But couldn't there be a cube which is also a square? (eg. 1000000=1000^2=100^3). Surely you'd be counting these cases twice.

Yes, but the question said, " How many positive integers <= 1000000 are squares or cubes?"
Perhaps it's a matter of interpretation. I took that to mean the number that were squares and the number that were cubes.
Hmm, anyone else got a comment?
meepmeep

5,6,15,16,25,26....95,96 (8x2x8)

Giving 200+160+128=488 positive integers with a 5 or 6 in their digits.

why is it not just 8x2
5,6,15,16,25,26,35,36,45,46,75,76,85,86,95,96
Fermat
Yes, but the question said, " How many positive integers <= 1000000 are squares or cubes?"
Perhaps it's a matter of interpretation. I took that to mean the number that were squares and the number that were cubes.
Hmm, anyone else got a comment?

how many integers under 1x10^6 are squares and cubes?
keithy
how many integers under 1x10^6 are squares and cubes?

10 integers under(and including 10^6 itself) are squares and cubes, ie 6th powers.
If you mean squares or cubes, then its
sqrt(10^6) + cuberoot(10^6) - 6th root(10^6)
manps
why is it not just 8x2
5,6,15,16,25,26,35,36,45,46,75,76,85,86,95,96

Because you also get 105, 106, 115, 116...195,196 all the way up to 995,996 (but missing out the 500s and 600s, which is why it was only 8x2x8).

Sorry about that. Should have clarified it a bit more.
JamesF
10 integers under(and including 10^6 itself) are squares and cubes, ie 6th powers.
If you mean squares or cubes, then its
sqrt(10^6) + cuberoot(10^6) - 6th root(10^6)

Yeah, I just got around to working that out
Here's my version.

N = 1,000,000
n1 = &#8730;N = 1000 => there are 1000 numbers, the integers for 1 to 1000 inclusive, that have squares less than, or equal to, 1,000,000.
n2 = ³&#8730;N = 100 => there are 100 numbers, the integers for 1 to 100 inclusive, that have cubes less than, or equal to, 1,000,000.

let n,m be integers s.t. <= 1,000,000 and <= 1,000,000.
n and m are constrained by having n=k³ and m=k²
=> k^6 = 1,000,000
=> k<=10
=======

In other words, all the integers form 1 to 10 inclusive can be taken to the sixth power and be less than or equal to 10^6.
And each one of these numbers, to the sixth power, can have a square root and a cube rooot.
So there are 10 duplicates in our list of squares and cubes.Total number of integers <= 1,000,000 which are squares or cubes is,

n = n1 + n2 - 10
n = 1000 + 100 - 10
n = 1090
======
Fermat
Yeah, I just got around to working that out
Here's my version.

N = 1,000,000
n1 = &#8730;N = 1000 => there are 1000 numbers, the integers for 1 to 1000 inclusive, that have squares less than, or equal to, 1,000,000.
n2 = ³&#8730;N = 100 => there are 100 numbers, the integers for 1 to 100 inclusive, that have cubes less than, or equal to, 1,000,000.

let n,m be integers s.t. <= 1,000,000 and <= 1,000,000.
n and m are constrained by having n=k³ and m=k²
=> k^6 = 1,000,000
=> k<=10
=======

In other words, all the integers form 1 to 10 inclusive can be taken to the sixth power and be less than or equal to 10^6.
And each one of these numbers, to the sixth power, can have a square root and a cube rooot.
So there are 10 duplicates in our list of squares and cubes.Total number of integers <= 1,000,000 which are squares or cubes is,

n = n1 + n2 - 10
n = 1000 + 100 - 10
n = 1090
======

meh it's its so simple, i should have actually tried to answer it myself instead of just asking thinking, it would be really hard :P. thankyou.