Detail Form
We will send your result on your email id and phone no. please fill detail
Given two integers L and R, write a program that finds the count of numbers having prime number of set bits in their binary representation in the range [L, R].
Example 1:
Example 2:
Your Task:
You dont need to read input or print anything. Complete the function primeSetBits() which takes L and R as input parameter and returns the count of numbers having prime number of set bits in their binary representation.
Expected Time Complexity: O(nlog(n)sqrt(n))
Expected Auxiliary Space: O(1)
Constraints:
1 <= L <= R <=1000
Given a number N, print all its unique prime factors and their powers in N.
N = 100 Factor Power 2 2 5 2 N = 35 Factor Power 5 1 7 1
Input:
The first line of input contains an integer T denoting the number of test cases.The first line of each test case is N.
Output:
Print all prime factors and their powers separated by spaces. The output should be printed in increasing order of prime factors.
Constraints:
1 ≤ T ≤ 200
2 ≤ N ≤ 10000
Example:
Given a number N, the task is to find the largest prime factor of that number.
Example 1:
Example 2:
Your Task:
You don't need to read input or print anything. Your task is to complete the function largestPrimeFactor() which takes an integer N as input parameters and returns an integer, largest prime factor of N.
Expected Time Complexity: O(sqrt(N))
Expected Space Complexity: O(1)
Constraints:
1 <= N <= 105