interesting-prime
Source: hackerearth
Difficulty: EASY

Taru and Chandu both are getting bored. So Taru thinks to play a game and he gives a number to Chandu and asks him to find the number of combinations formed by divisors in form of prime.     
For example:-
For N   = 36 divisor in form of prime are ( 2 , 2 , 3 , 3 )
Number of combinations formed by prime divisor of 36 are 8.
Check the sample I/O for better understanding.

INPUT-
Number of test cases T. Next T lines contain a number N.

OUTPUT-
Number of different combinations formed by divisors in form of prime of N. 

CONSTRAINTS-
1 ≤ T ≤ 100
1 ≤N ≤ 10^12

SAMPLE INPUT
1
36

SAMPLE OUTPUT
8

Explanation

2,2,3,3  are divisors in form of prime for 36 and different/unique combinations formed are -
(2) , (3) , (2,3) , (2,2) , (2,2,3) , (3,3) , (2,2,3,3) , (2,3,3).


import sys

T = int(sys.stdin.readline().strip('\n'))
while T:
	T -= 1
	N = int(sys.stdin.readline().strip('\n'))
	n = int(N ** 0.5) + 1

	fact1 = 0
	fact2 = 0
	for i in range(2, n):
		if i*i == N:
			fact1 += 1
			continue
		if N % i == 0:
			fact2 += 1
	print((fact1 + (fact2 << 1) + 1))




def primes(n):
	"Find prime factors of a number"
	fac = []
	d = 2
	while d*d <= n:
		while (n%d) == 0:
			fac.append(d)
			n /= d
		d += 1
	if n > 1:   fac.append(n)
	return fac

for cases in range(int(input())):
	n = int(input())
	factors = primes(n)
	d = {}
	for i in factors:
		if i not in d:  d[i] = 0
		d[i] += 1
	total = 1
	distinct = 0
	for i in d:
		if d[i] == 1:   distinct += 1
		else:   total *= d[i]+1
	total *= 2**distinct
	print(total - 1)


import sys,math
import itertools
def prime_fact(number):
	prime=[]
	while(number%2==0):
		prime.append(2)
		number=number/2
	for i in range(3,int(math.sqrt(number))+1,2):
		while(number%i==0):
			prime.append(i)
			number=number/i
	if(number>2):
		prime.append(number)
	return prime
tcases=eval(input())
for i in range(0,tcases):
	count=0
	n=eval(input())
	l1=prime_fact(n)
	for j in range(1,len(l1)+1):
		l2=list(itertools.combinations(l1, j))
		count=count+len(set(l2))
	print(count)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
import itertools

def nCr(listOfPrimes):
	resultSet = set()
	for L in range(0, len(listOfPrimes)+1):
		for subset in itertools.combinations(listOfPrimes, L):
			if len(subset) !=0 :
				resultSet.add(subset)
	return len(resultSet)

def get_primes(num):
	i = 2
	results = []
	while i * i <= num:
		if num%i == 0:
			results.append(i)
			num = num/i
		else:
			i = i + 1
	results.append(num)
	return results
	
if __name__ == "__main__":
	times = int(input())
	for i in range(0,times):
		num = int(input())
		print(nCr(get_primes(num)))
	



'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
import itertools

def primes(n):
	prime_fac = []
	if n <= 2:
		prime_fac.append(n)
		return prime_fac

	d = 2
	while d * d <= n:
		while n % d == 0:
			prime_fac.append(d)
			n /= d

		d += 1

	if n > 2:
		prime_fac.append(n)

	return prime_fac


num = int(input())
for n in range(num):
	item = int(input())
	prime_lst = primes(item)
	comb = set()
	for i in range(len(prime_lst)):
		comb.update(itertools.combinations(prime_lst, i + 1))
		
	print(len(comb))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
import math

def prime_factors(m):
	n = int(m)
	factor_count = {}
	
	while n%2 == 0:
		try:
			factor_count['2'] = factor_count['2'] + 1
		except:
			factor_count['2'] = 1
		n = int(n/2)
		
	i = 3
	limit = int(math.sqrt(n))
	while i<=limit:
		while n%i == 0:
			try:
				factor_count[str(i)] = factor_count[str(i)] + 1
			except:
				factor_count[str(i)] = 1
			n = int(n/i)
		i = i + 2
		
	if n>2:
		factor_count[str(n)] = 1
		
	return factor_count
	
t = int(input())
while t:
	n = input()
	factors = prime_factors(int(n))
	count = 1
#	print factors
	for f in factors:
		count =  count*(factors[f]+1)
	t = t - 1
	print(count - 1)

		
		
		



MAXI = 10**6 + 10
def calc_prime():
	is_prime = {val:True for val in range(MAXI)}
	is_prime[0] = is_prime[1] = False
	prime_list = []
	for i in range(MAXI):
		if is_prime[i]:
			for j in range(i*i, MAXI, i):
				is_prime[j] = False
			prime_list.append(i)
	return prime_list
	
T = int (input())
prime_list = calc_prime()
while T > 0:
	T -= 1
	N = int(input())
	fact = []
	for val in prime_list:
		if val > N: 
			break
		cnt = 0
		while N%val == 0:
			N /= val
			cnt += 1
		if cnt > 0:
			fact.append((val, cnt))
	if N > 1:
		fact.append((N, 1))
	ans = 1
	for f in fact:
		num, cnt = f
		next_val = ans*cnt
		ans += next_val
	print(ans - 1)
		
		


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
t=int(input())

for i in range(t):
	n=int(input())
	c=1
	k=int(n ** 0.5)
	#print(k)
	for j in range(2,k+1):
		#print(j)
		if(n%j==0):
			#print(j)
			if(j*j == n):
				c+=1
			else:
				c+=2
	if n==1:
		print("0")
	else:
		print(c)


# making sieve
mx=int(10**6+1)

chk=[False]*(10**6+1)
sieve=[]

for i in range(2,mx) :
	if not chk[i] :
		sieve.append(i)
		for j in range(2*i,mx,i) :
			chk[j]=True



t=int(input())

while t :
	t-=1
	n=int(input())
	
	ans=int(1)
	
	for i in sieve :  #check for every prime
		cnt=int(0)     #power_cnt
		while n%i==0 :    #division untill it does not divides it
			n/=i
			cnt+=1    
		if cnt :      # if some power is there mutiply it
			ans*=(cnt+1)
		if n==1 :
			break
		
	if n!=1 :
		ans*=2
							# number of divisors...........
	print(ans-1)  #decrementing 1's conut its not considered  
	


t=eval(input())
while(t>0):
	t=t-1
	n=eval(input())
	primefac={}
	d=2
	while d*d <=n:
		while (n%d)==0:
			if d not in primefac:
				primefac[d]=0
			primefac[d]+=1
			n//=d
		d+=1
	if n>1:
		primefac[n]=1
	if len(primefac)==0:
		print(1)
	else:
		sols=1
		for w,v in list(primefac.items()):
			sols=sols*(primefac[w]+1)
		print(sols-1)

	


test=int(eval(input()))
import math
for t in range(test):
	n=int(eval(input()))
	x={}
	while n%2==0:
		x[2]=x.get(2,0)+1
		n=n//2
	i=3
	while i<=math.sqrt(n):
		while n%i==0:
			x[i]=x.get(i,0)+1
			n=n//i
		i+=2
	if n>2:
		x[n]=x.get(n,0)+1
	p=1
	for i in list(x.keys()):
		p=p*(x[i]+1)
	p=p-1
	print (p)


def noOfFactors(n):
	result = set()
	for i in range(1, int(n ** 0.5) + 1):
		div, mod = divmod(n, i)
		if mod == 0:
			result |= {i, div}
	return len(result) - 1 #removing 1



def main():
	T = eval(input())
	for i in range(T):
		N = eval(input())
		print(noOfFactors(N))

if __name__ == '__main__':
	main()





import math

t = eval(input())
for xx in range(0,t):
	n = eval(input())
	s = math.sqrt(n)
	s += 1
	ans = 1
	s = int(s)
	for i in range(2,s):
		ct = 0
		while( (n%i) == 0 ):
			n /= i;
			ct += 1
		ans *= (ct+1)
	if(n != 1):
		ans *= 2
	print(ans-1)


def primes(n):
	fac = []
	d = 2
	while d*d <= n:
		while (n%d) == 0:
			fac.append(d)
			n /= d
		d += 1
	if n > 1:   fac.append(n)
	return fac

for cases in range(int(input())):
	n = int(input())
	factors = primes(n)
	d = {}
	for i in factors:
		if i not in d:  d[i] = 0
		d[i] += 1
	total = 1
	distinct = 0
	for i in d:
		if d[i] == 1:   distinct += 1
		else:   total *= d[i]+1
	total *= 2**distinct
	print(total - 1)


import math
test_cases=eval(input())
factors=set()
for j in range(1,test_cases+1):
	n=eval(input())
	root_n=int(math.sqrt(n))
	for i in range(1,root_n+1):
		a=n/i
		b=n%i
		if b==0:
			factors.add(a)
			factors.add(i)
	if n==1:
		print(1)
	else:
		print(len(factors)-1)
	factors.clear()


from itertools import combinations
def primes(n):
	primfac = []
	d = 2
	while d*d <= n:
		while (n % d) == 0:
			primfac.append(d)  # supposing you want multiple factors repeated
			n //= d
		d += 1
	if n > 1:
		primfac.append(n)
	return primfac

t = int(input())
for i in range(t):
	n = int(input())
	prim = primes(n)
	p = len(prim)
	c=0
	for i in range(1,len(prim)+1):
		c+=len(set(combinations(prim,i)))
	print(c)


def getfactors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n /= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return factors
for _ in range(eval(input())):
	n=eval(input())
	l=getfactors(n)
	seti=set(l)
	d=0
	k={}
	for s in seti:
		t=l.count(s)
		if t>1:
			k[s]=t
			d+=1
	ans=1
	##print d,k
	for item in k:
		ans=ans*(k[item]+1)
	ans=ans*2**(len(seti)-d)
	print(ans-1)


import itertools

def primes(n):
	primfac = []
	d = 2
	while d*d <= n:
		while (n % d) == 0:
			primfac.append(d)
			n //= d
		d += 1
	if n > 1:
	   primfac.append(n)
	return primfac

for _ in range(eval(input())):
	stuff = primes(eval(input()))
	st = set()
	for L in range(0, len(stuff)+1):
	  for subset in itertools.combinations(stuff, L):
		st.add(subset)

	print(len(st) -1)