The set S contains integers in the range 1 to 5 0 inclusive.
What is the largest number of elements you can have in the set such that no two numbers in the set can be multiplied by the same integer to form perfect squares?
For example, 1 and 4 can't both be in the set since they could each be multiplied by 9 to form perfect squares, 9 and 3 6 .
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.
I did the same thing but I missed something. I ended with answer 34. We need to be very careful in case of these type of problems.
I tried to figure the pair of numbers which would follow the above instructions, my list went like this : 1 and 4. (both by 9) 2 and 8. (Both by 8) 3 and 12. (both by 3) 4 and 16 (both by 4) 5 and 20 (both by 5) 6 and 24 (both by 6) 7 and 28 (both by 7) 8 and 32 (both by 2) 9 and 36 (both by 4) 10 and 40(both by 10) 11 and 44(both by 11) 12 and 48(both by 3) Also, numbers like 25 and 49 can be paired with 1 and both be multiplied by 1. This adds up to only 19 numbers (since 4, 8 and 12 have been counted twice). Can you solve my doubt?
Log in to reply
The 31 numbers I had left were 1, 2, 3, 5, 6, 7, 10, 11, 13, 14, 15, 17, 19, 21, 22, 23, 26, 29, 30, 31, 33, 34, 35, 37, 38, 39, 41, 42, 43, 46, and 47.
thats pretty cool.
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]=>[1, 4, 9, 16, 25, 36, 49]
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]=>[2, 8, 18, 32, 50]
[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]=>[3, 12, 27, 48]
[0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]=>[5, 20, 45]
[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]=>[6, 24]
[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]=>[7, 28]
[1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]=>[10, 40]
[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]=>[11, 44]
[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]=>[13]
[1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]=>[14]
[0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]=>[15]
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]=>[17]
up to . . .
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]=>[47]
This is a hash with 31 entries.
Log in to reply
HASH = (1..50).group by{|x|pd = x.prime division; PRIMES.collect{|p|(pd.assoc(p) || [0,0]).last % 2}}
HASH.keys.length
What? I had the right method but got it wrong!
This is same as asking "how many numbers between 1 and 50 are square-free?"
There are 1 , 2 , 3 , 5 , 6 , 7 , 1 0 , 1 1 , 1 3 , 1 4 , 1 5 , 1 7 , 1 9 , 2 1 , 2 2 , 2 3 , 2 6 , 2 9 , 3 0 , 3 1 , 3 3 , 3 4 , 3 5 , 3 7 , 3 8 , 3 9 , 4 1 , 4 2 , 4 3 , 4 6 , 4 7 , so there are 31 in total.
I tried to figure the pair of numbers which would follow the above instructions, my list went like this : 1 and 4. (both by 9) 2 and 8. (Both by 8) 3 and 12. (both by 3) 4 and 16 (both by 4) 5 and 20 (both by 5) 6 and 24 (both by 6) 7 and 28 (both by 7) 8 and 32 (both by 2) 9 and 36 (both by 4) 10 and 40(both by 10) 11 and 44(both by 11) 12 and 48(both by 3) Also, numbers like 25 and 49 can be paired with 1 and both be multiplied by 1. This adds up to only 19 numbers (since 4, 8 and 12 have been counted twice). Can you solve my doubt?
Log in to reply
You found all the numbers that can be paired as described in the problem, of which there are 19. Take those numbers away, and you're left with 5 0 − 1 9 = 3 1 numbers that can't be paired that way, which is what the problem is asking for.
These are prime numbers between 1 and 50 (15 prime numbers) and their products [ product of two, three or more (more than three not applicable as product <= 50) prime numbers chosen from these 15 prime numbers] with product in the range 1 to 50. All these total to 31.
This problem can also be solved by removing numbers whose prime factors contain multiplicity > 1. There are such 19 numbers,
4, 8, 9, 12,16,18, 20, 24, 25, 28, 30, 32, 36, 40, 44, 45, 48, 49, 50
Thus, the set S contains remaining 31 numbers.
How about 1?
I tried to figure the pair of numbers which would follow the above instructions, my list went like this : 1 and 4. (both by 9) 2 and 8. (Both by 8) 3 and 12. (both by 3) 4 and 16 (both by 4) 5 and 20 (both by 5) 6 and 24 (both by 6) 7 and 28 (both by 7) 8 and 32 (both by 2) 9 and 36 (both by 4) 10 and 40(both by 10) 11 and 44(both by 11) 12 and 48(both by 3) Also, numbers like 25 and 49 can be paired with 1 and both be multiplied by 1. This adds up to only 19 numbers (since 4, 8 and 12 have been counted twice). Can you solve my doubt?
Log in to reply
This is the correct tinking... Now you just need to subtract this from 50 and bingo... 31
This problem can also be solved by removing numbers whose prime factors contain multiplicity > 1. There are such 19 numbers,
4, 8, 9, 12,16,18, 20, 24, 25, 28, 30, 32, 36, 40, 44, 45, 48, 49, 50
Thus, the set S contains remaining 31 numbers.
I created a simple code using C.
Instead of taking two numbers and working on them, we work on the common integer with which we are multiplying them.
1 ] Lets us consider multiplication tables of numbers 1 to 50.
2 ] We have to consider the Multiplication Tables upto factor of 50 i.e,
1 × 1 , 1 × 2 , 1 × 3 , . . . . . 1 × 5 0
2 × 1 , 2 × 2 , 2 × 3 , . . . . . . 2 × 5 0
.
.
5 0 × 1 , 5 0 × 2 , 5 0 × 3 , . . . . . . 5 0 × 5 0
3 ] Now, take a look at all those tables. Look for all perfect squares and exclude self multiple in table of a particular number. Example, exclude numbers like 1 × 1 = 1 , 2 × 2 = 4 , 3 × 3 = 9 . . . . . . . . 5 0 × 5 0 = 2 5 0 0 because the common integer should be different from the 2 numbers or else the answer turns out 0. It is not specified in the question, I tried 0 first, got it wrong, so I concluded.
4 ] So, now lets consider other perfect squares. Now, I will tell what my code does,
A ) It takes a number from 1 to 5 0 .
B ) It makes their multiplication tables and looks for the perfect squares.
C Then it divides those perfect squares with the number of the respective table.
D ) Then out of the output I exclude a number based on condition in 3 ] .
E ) Now, important here, the total number left in the output should be ≥ 2 .Since, two numbers in Question
5 ] Now exclude the numbers left from the set 1 , 2 , 3 , 4 , 5 , 8 , 9 , 1 2 , 1 6 , 1 8 , 2 0 , 2 5 , 2 7 , 3 2 , 3 6 , 4 5 , 4 8 , 4 9 , 5 0 (I get these numbers based on all conditions) and we are left with 31 numbers
Number of elements in S = 3 1 .
I categorised it into 2 subsets First subset contains 1 and all prime numbers within the given range, there are 16 such numbers for set [1,50]
S1={1,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47}
The other subset contains the product of these prime numbers (product of two or more prime numbers), the final product should be within range, there are 15 such numbers (13 are product of two prime numbers and 2 are product of three prime numbers)
S2={6,10,14,22,26,34,38,46,15,21,33,39,35}
S3={30,42}
Therefore, the total is 31.
NOTE: all numbers in the set can be factored to single power of prime numbers, if the power of prime numbers is more than 1, then the set also contain a number so that the product of these two numbers can be a square.
Problem Loading...
Note Loading...
Set Loading...
Two numbers can be multiplied by the same integer for form a perfect square only if the parities of the exponents of their prime factors match. (In the example given, 1 and 4 can't both be in the set because both have an even exponents on the prime factor 2.)
To find the largest number of elements in the desired set, we can keep the lowest number for each set of numbers with the same parity of exponents of prime factors, and eliminate the others. For numbers with all even exponents (the square numbers 1, 4, 9, 16, 25, 36, 49) we can keep the 1 and eliminate 4, 9, 16, 25, 36, and 49; For numbers with all with all even exponents except an even 2 (2, 8, 18, 32, 50) we can keep the 2 and eliminate 8, 18, 32, and 50; and so on.
Using this strategy, we end up eliminating all square numbers greater than 1 and their multiples. There are 12 multiples of the square number 4 in [1, 50] that are all eliminated (4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, and 48). There would be 5 multiples of the square number 9 in [1, 50] that would be eliminated, except element 36 was already eliminated as a multiple of 4, so really just 4 new elements are eliminated (9, 18, 27, and 45) for a total of 16 elements eliminated. Since the square number 16 is already a multiple of 4, no new elements would be eliminated for those multiples. There are 2 multiples of the square number 25 in [1, 50] that are eliminated (25 and 50) for a total of 18 elements eliminated. Since the square number 36 is already a multiple of 4, no new elements would be eliminated for those multiples. Finally, there is 1 multiple of the square number 49 in [1, 50] that is eliminated (49) for a total of 19 elements eliminated.
Out of the 50 starting elements, 19 are eliminated, which leaves a set with 31 elements .