A king has a chest that is filled with pearls. He wants to find a good and reliable treasurer to take care of his pearls. As such, he created a riddle for his villagers to solve; whosever solved it correctly first will become the new royal treasurer. The riddle is as follows:
"In this chest I have a number of pearls.
If I remove one, the number becomes a perfect square.
If I remove 2, the number becomes a multiple by 9.
If I divide these pearls amongst 5 knights equally, there is 1 left over.
If I divide them amongst 8 knights, then there are 5 left over.
The number of pearls is prime."
What is the minimum number of pearls in the king's chest?
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.
Trial by hand takes less time than writing the program.
101-1=100 which is a perfect square 101-2=99 divisible by 9 and if 101 divided by 5 1 is the remainder
nice program
x-1 is divisible by 5 with mod 1.x is a prime we can conclude last digit is 1. 101-1is a perfect square mod(101,8)=5. so it's correct
it was just quite easy ... u can do it by trail and error method. since no. of pearls is prime and is divisible by 5 therefore last digit is 1 and 101 is the answer
my solution in python for i in xrange(1,2345): if float((i-1) **(0.5)) in xrange(i) and (i-2)%9==0 and i%5==1: print i,
I wrote a python line to fulfill all conditions
Number = min ( ( (i * i) +1 for I in xrange(1000) if ((i * i)+1)%5 == 1 and ((i * i)+1)%8 == 5 and ((i * i)-1)%9== 0 ))
(Y)
I first sorted out among the conditions the most useful one. In the ques the number let it be X , (X-1) is a perfect square and X mod 5 is 1. So that suggests (X-1) is a multiple of 5 and is a square number.
Now the problem is easy enough. square number divisible by 5 are 25,100,225......
25 does not fulfill other conditions. Then moving on to 100 and yes it meets all conditions mentioned.
So number is 100+1=101
thanx @Md. Maidul Islam Rasu , ur explanation helped :)
We need to know the number of pearls which satisfy all four conditions.If we see condition number 3,when divided in 5 knites,1 pearl is left that means last digit is 1,this satisfies condition number 1 as well.Now look for condition number 2 that is if 2 number are talen out ,remaining is multiple of 9 so we reach to number 99 +2( this satisfies earlier two conditions as well. last one divided in 8 knites ,left over pearls are 5.So total number of pearls are 101 in the chest.Ans.
K.K.GARG,India
Let the number be X. We are told that k^2 + 1 = X, and that X is prime. We are also given that k^2 is a multiple of 5. Since 5 is prime, k^2 must be divisible by 25. We are also told that k^2 must be divisible by 4, as (k^2 - 4 ) divided by 8 = an integer. Therefore k^2 is a multiple of 100.
But k^2 - 1 is divisible by 9, so the digit sum of k^2 - 1 must equal a multiple of 9. This doesn't work for any multiple of a 100 below 1,000, except 1000 (which gives 999) or 100 (which gives 99). Since 1000 isn't a square number, the only remaining solution less than 1000 is 100.
If we try out 100, we find that it works, so the number of pearls is 101. I thought this was a rather nice solution, other than the guesswork at the end.
The faster method: let number of pearls be x, then, x (mod 8)=5 ; then the values satisfying above restrictions were:13,21,29...... but as we know that , x(mod 5)=1 also, then values satisfying above restrictions were:21,61,101....... then again if u quickly notice 101 is a prime and 100 is a perfect square, then problem is solved ,but this was a trial and error method , So,I made a blue j program for it: import java.io.*; class xyz {
Condition 3: Number ends in 1 or 6.
Condition 5: Number cannot end in 6, so it has to end in 1.
So, when I remove one, it should end in 0. Which takes us to Condition 1: If this number that ends in 0 is a perfect square, it has to end with two zeroes. Smallest possible value is 100, which means our answer could be 101.
Now verify Conditions 2 and 4. They hold. Hence, 101 is the answer.
x-1 is divisible by 5 with mod 1.x is a prime we can conclude last digit is 1. 101-1is a perfect square mod(101,8)=5. so it's correct
let the soln be of the form m^2+1 also this m^2+1=5k+1 so m^2=5k so k= 5a^2 and m= 5a now m^2+1=8l+5 therefore m^2= 4(2l+1) or 25a^2=4(2l+1) clearly 2l+1 is odd so a^2 is 4 or a is 2 so mis 5a i.e. 10 and no. is 10^2 + 1 i.e. the final ans is 101
Let N be the number of pearls. Since N is prime it has to be odd (as 2 can be ruled out easily). Using condition 3 (that is, N-1 is divisible by 5), N=5p+1 for some integer p. If p is odd then N will be even leading to a contradiction. Hence, p is even thus N should end in 1, that is, N=10q+1 for some integer q. Using condition it can be further concluded that N=100n^2+1. The smallest of these is 101 which satisfies all the conditions.
For sake of completeness: we can show that condition 4 is satisfied for all odd n. Hence, N=100(2m+1)^1+1=400m(m+1)+101. This satisfies all the conditions if m or m+1 is divisible by 9. The smallest of course is 101 (with m=0). The next two are 28901 and 36101 and so on.
Consider x=no. of pearls. 1)Then x-1 is perfect square 2)x-2 is divisible by 9 3)x-1 is divisible by 5 4)x-5 is divisible by 8. Now from condition 1 & 2 we have to find perfect square which is divisible by 5.. its simple like 5^2, 10^2... Now check other conditions...
take first 10 perfect squares 1 4 9 16 25 36 49 64 81 100
than add 1 to each value to get supposed number of pearls 2 5 10 17 26 37 50 65 82 101
now take prime numbers from these numbers 2 5 17 37 101
by subtracting 2 from each number
0 3 15 35 99
as from the above values only 99 is the multiple of 9
also if we divides 101 by 5 we shall get 1 left
and if we divide 101 by 8 , 5 will be left
hence 101 is the exact value that satisfies each point
i tried to find the least no that is in the form of 5X+1=8Y+5=9Z+2=101 i.e. also satisfy the first condition.
Problem Loading...
Note Loading...
Set Loading...
The faster method: let number of pearls be x, then,
x (mod 8)=5 ; then the values satisfying above restrictions were:13,21,29...... but as we know that ,
x(mod 5)=1 also,
then values satisfying above restrictions were:21,61,101.......
then again if u quickly notice 101 is a prime and 100 is a perfect square, then problem is solved ,but this was a trial and error method ,
So,I made a blue j program for it:
import java.io.*;
class xyz
{
}
First the array stores all primes numbers between 1 and 10,000, then the array of prime numbers checks for other restrictions. and Boom,it gives only 1 output which is 101.!!!