Tuesday, 13 September 2016

Maximum unique prime factor

Standard
Given q queries with each query containing a number n , your task is to find the maximum number of unique prime factor of a number in the range [1, n]

for example:-
if n=10
then in the range 1, 2,3,4,5,6,7,8,9,10
6 =2*3 and 10=2*5 has 2 unique prime factors, all other number have either 0 (1 in this case) or 1 ( 2,3,4,5,7,8,9) unique prime factors.
so your output will be.
2

if  n=1000
then in the range [1,1000]
the number 210 = 2*3*5*7 has 4 unique prime factors which is the maximum in the range [1,1000]
So your output will be
4

here is the input to your code.
11
100
210
999
1999
387456
12337857
1000000000
1222326389726
87562986844627
4269888900268907
98346736477364738

Submit your answers in the comment section.
You can use any of the following online compiler.


Related Posts:

  • Prime factors Given a q queries with each containing a number n , print all the prime factors on n separated by space. for example :- if n=100, print  2 2 5 … Read More
  • Unique prime factors You are given q queries with each query containing  a number n , your task is to find and print it's total number of unique prime factor . … Read More
  • Maximum unique prime factor Given q queries with each query containing a number n , your task is to find the maximum number of unique prime factor of a number in the range … Read More

0 comments:

Post a Comment