How many (positive) prime numbers are there, whose square has 5 or 6 digits?
Details and assumptions
You may use the fact that there are 168 primes less than 1000.
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.
Good clear explanation!
i get it now, . . . the question is wrong that's why i don't get it. . . . the question must be "What prime number whose square is 5 or 6 digits".
Your pretty good Vivek I LIKE THE WAY YOU SHOW YOUR solution IS TOO Clear
Looking at the smallest integer that has a square with 5 digits is 100. The largest integer with a square with 6 digits is 999. Looking at this, we can show that all primes with a square that has 5 or 6 digits is more than 100 and less then 999. In an equation : 100 < x < 999
To make things easier, we can get the number of primes less than 100 and subtract it from the total number of primes less than 1000. This gives us an equation: 168 - 25. The answer to that is 144.
Woops, its supposed to be 143
997^2=994009 1009^2=1018081
997 is the largest prime number with a square of 5 or 6 digits
101^2=10201 97^2=9409
101 is the smallest prime number with a square of 5 or 6 digits.
101 is the 26th prime number. 997 is the 168th because there are 168 prime numbers below 1000.
168-26+1=143
if (flag==2)
{
if( (j*j)>=10000 && j*j<=999999)
{
count++;
cout<<"Value of j:\t"<<j<<"Square:"<<(j*j)<<"\t count:\t"<<count<<endl;
}
}
}
int main() { int i; for(int j=0;j<=10000;j++) prime(j); cout<<"Value of count\t"<<count<<endl;
// cout<<x<<endl; system("pause"); return 0; }
PRIME NUMBERS HAVING SQUARES 5 OR 6 DIGIT ARE STARTING FROM 100. SO,FROM HINTS U CAN FIND THAT ONLY 25 PRIME NUMBERS ARE LESS THAN 100 NOT HAVE SQUARE 5 or 6 DIGITS
Since it wants prime numbers with sq 5 digits or 6 digits (10000 - 999999), effectively if you sqrt both, you get 100 - 999. Given there are 168 primes under 1000, find the number of primes under 100 (25), then use 168 - 25. This gives us the answer 143.
its very easy, 1-100 have prime squares of at most for digits, 5 and 6 digits are between 101 and 999,. so we get the number of prime squares from 1-100 and subtract from the total number of prime squares, therefore, prime squares of 5-6 digits= total prime squares from 1-1000 minus number of prime squares from 1-100= 168-25=143. simple!
Given the fact that 168 primes are less than 1000, we know that a number squared, will have the (amount of digits that it has)*2...Therefore the prime must have 3 digits, to determine this number we do 168-25=143, 168 is from total 1-digit, 2-digit and 3-digit primes while 25 is from the number of 1 and 2 digit primes. So our answer here to his question is143
We know there are 168 primes in the first 1000 numbers
We also know that the square of any number above 99 and below 1000 will have either 5 or 6 digits
So at this point we only have to count the total of prime numbers below 99 which is 25
Therefore:
168 total prime numbers in the first 1000 numbers - 25 prime numbers whose squares have less than 5 digits = 143 prime numbers whose digits are 5 or 6
there are 25 primes below 100. square(100) = 10000=1st no of 5 digits && square(1000) = 1000000=1st no of 7 digits.1000 is not a prime number so no of prime whose square has 5 digit or 6 digit = no of prime between 100 & 1000. so ans = 168 - 25 = 143
Problem Loading...
Note Loading...
Set Loading...
solution: we know that there are 25 prime numbers are between 1-100 and 168 prime numbers less than 1000. 100 x 100=10000(5 digits) 999 x 999=998001(6 digits) 1000 x 1000=1000000(7 digits) so our answer should be same as the number of prime numbers between 100 to 999. hence, 168-25=143. 143 prime numbers will be there less than 1000 whose square has 5 or 6 digits.