Mehta is a very lazy boy. He always sleeps in Maths class. One day his teacher catches him sleeping and tells him that she would mark him absent for the whole semester. While she pretends to be strict, she is actually very kind-hearted. So she wants to give Mehta a chance to prove himself. She gives him a problem. If Mehta can answer it correctly, she will forgive him. Can you help Mehta find the answer to this problem?  

The problem: The teacher gives Mehta a number $N$ and asks him to find out the probability that any proper divisor of $N$ would be an even perfect square.  

Note: Even perfect square means the number should be even and a perfect square.  

Input Format 

The first line of input contains an integer $\mathbf{T}$, the number of test cases. 

$\mathbf{T}$ lines follow, each line containing $N$, the number that the teacher provides.  

Output Format 

For each test case, print in a newline the output in $p/q$ format where $\boldsymbol{p}$ and $\textit{q}$ are positive coprime integers. 

if $\boldsymbol{p}$ is 0, you should simply output 0.  

Constraints 

$1\leq T\leq4\times10^4$ 

$2\leq N\leq10^6$  

Sample Input

4
2
8
36
900

Sample Output

0
1/3
1/8
3/26

Explaination 

For the first case $N=2$, the set of proper divisors is $\{1\}$. Since $1$ is not an even perfect square, the probability is $0$. 

For the second case $N=8$, the set of proper divisors is $\{1,2,4\}$ and only $4$ is an even perfect square among them, so probability = $1/3$. 

For the third case $N=36$, the set of proper divisors is $\{1,2,3,4,6,9,12,18\}$, and only $4$ is an even perfect square, so probability = $1/8$. 

For the fourth case $N=900$, there will be total of $26$ proper divisors and $3$ of them $\{4,36,100\}$ are even perfect squares.

Source: hackerrank | Difficulty: MEDIUM_HARD
Tags: Number theory


Solutions:
import fractions

def primes(n):
	primfac = {}
	d = 2
	while d * d <= n:
		while n % d == 0:
			if d in primfac:
				primfac[d] += 1
			else:
				primfac[d] = 1
			n /= d
		d += 1
	if n > 1:
		if n in primfac:
			primfac[n] += 1
		else:
			primfac[n] = 1
	return primfac

def numf(n):
	prod = 1
	dictx = primes(n)
	for i in dictx:
		prod *= dictx[i] + 1
	return prod - 1

def numeps(n):
	if n % 4 != 0:
		return 0
	else:
		n = int(n / 4)
		prod = 1
		dictx = primes(n)
		for i in dictx:
			prod *= int(dictx[i] / 2 + 1)
		if n ** 0.5 % 1 == 0:
			return prod - 1
		else:
			return prod

def simplify(num, denom):
	gcd = fractions.gcd(num, denom)
	num = int(num / gcd)
	denom = int(denom / gcd)
	return str(num) + '/' + str(denom)

def compute(n):
	if numeps(n) == 0:
		return 0
	return simplify(numeps(n), numf(n))
ints = int(input())
for i in range(ints):
	print(compute(int(input())))


from fractions import gcd
N = 10 ** 6 + 1
p = []
lowDiv = [-1] * N
for i in range(2, N):
	if lowDiv[i] == -1:
		p.append(i)
		lowDiv[i] = i
	for m in p:
		if m > lowDiv[i]:
			break
		x = m * i
		if x >= N:
			break
		lowDiv[x] = m

def solve(x):
	if x % 2 == 1:
		return 0
	(total, good) = (1, 1)
	allGood = True
	while x > 1:
		p = lowDiv[x]
		q = 0
		while x % p == 0:
			x //= p
			q += 1
		if q % 2 != 0:
			allGood = False
		total *= q + 1
		if p == 2:
			good *= q // 2
		else:
			good *= q // 2 + 1
	total -= 1
	if allGood:
		good -= 1
	if good == 0:
		return 0
	g = gcd(good, total)
	return '{}/{}'.format(good // g, total // g)
t = int(input())
for _ in range(t):
	print(solve(int(input())))


from math import sqrt
from fractions import gcd

def rwh_primes1(n):
	sieve = [True] * (n // 2)
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i // 2]:
			sieve[i * i // 2::i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [2 * i + 1 for i in range(1, n // 2) if sieve[i]]

def primeDecomposition(n, primes):
	i = 0
	dec = dict()
	sqroot = int(n ** 0.5)
	while n > 1:
		p = primes[i]
		if p > sqroot:
			break
		r = n % p
		exp = 0
		while r == 0:
			exp += 1
			n //= p
			r = n % p
		if exp != 0:
			dec[p] = exp
		i += 1
	if n > 1:
		dec[n] = 1
	return dec

def divRec(divPart, i):
	if i == len(decPairs):
		listDivs.append(divPart)
		return
	divRec(divPart, i + 1)
	for _ in range(1, decPairs[i][1] + 1):
		divPart *= decPairs[i][0]
		divRec(divPart, i + 1)

def divisorsFromDec(dec):
	global decPairs, listDivs
	listDivs = []
	decPairs = list(dec.items())
	divRec(1, 0)
	return sorted(listDivs)

def solve(n):
	dec = primeDecomposition(n, lPrimes)
	divs = divisorsFromDec(dec)[:-1]
	nbTot = len(divs)
	nbEvenPerfSq = 0
	for d in divs:
		if d % 2 == 0:
			sqr = sqrt(d)
			if sqr == int(sqr):
				nbEvenPerfSq += 1
	pgcd = gcd(nbTot, nbEvenPerfSq)
	a = nbEvenPerfSq // pgcd
	b = nbTot // pgcd
	return (a, b)
lPrimes = rwh_primes1(1000000)
T = int(input())
for _ in range(T):
	n = int(input())
	(a, b) = solve(n)
	if a == 0:
		print(0)
	else:
		print(str(a) + '/' + str(b))


from fractions import gcd
from math import sqrt

def primeSieve(n):
	li = [0] * (n + 1)
	li[0] = li[1] = 1
	for i in range(n + 1):
		if li[i] == 0:
			for j in range(2, n + 1):
				if i * j < n + 1:
					li[i * j] = 1
				else:
					break
	res = []
	for i in range(n + 1):
		if li[i] == 0:
			res.append(i)
	return res
q = [int(input()) for _ in range(int(input()))]
prli = primeSieve(max(q))

def primeFact(n):
	p = 0
	m = 0
	li = []
	while True:
		if n % prli[p] == 0:
			n //= prli[p]
			m += 1
		else:
			if m:
				li.append([prli[p], m])
			if n == 1:
				break
			p += 1
			m = 0
	return li

def f(n):
	if n % 4:
		return '0'
	li = primeFact(n)
	(p, q) = (li[0][1] // 2, li[0][1] + 1)
	for i in range(1, len(li)):
		p *= li[i][1] // 2 + 1
		q *= li[i][1] + 1
	if q & 1:
		p -= 1
	q -= 1
	g = gcd(p, q)
	(p, q) = (p // g, q // g)
	return '{}/{}'.format(p, q)
for e in q:
	print(f(e))


M = 1000100
d = [0 for i in range(M)]
f = [0 for i in range(M)]

def up(a, b):
	return (a - 1) // b + 1
for i in range(1, M):
	for j in range(2, up(M, i)):
		d[j * i] += 1
	for j in range(2, up(M, 4 * i * i)):
		f[j * 4 * i * i] += 1

def gcd(x, y):
	while x > 0:
		(x, y) = (y % x, x)
	return y
t = int(input())
for i in range(t):
	n = int(input())
	g = gcd(f[n], d[n])
	if f[n] == 0:
		print(0)
	else:
		print(str(f[n] // g) + '/' + str(d[n] // g))


from math import sqrt

def hipow(n, p):
	if n % p != 0:
		return 0
	k = 1
	a = p
	while n % (a * a) == 0:
		k *= 2
		a = a * a
	low = k
	hi = 2 * k - 1
	mid = k + (hi - low) // 2
	while hi - low > 1:
		if n % pow(p, mid) == 0:
			low = mid
			mid = low + (hi - low) // 2
		else:
			hi = mid - 1
			mid = low + (hi - low) // 2
	if n % pow(p, 1 + mid) == 0:
		mid += 1
	return mid

def gcd(a, b):
	while a % b != 0:
		(a, b) = (b, a % b)
	return b
t = int(input())
for test in range(t):
	n = int(input())
	if n % 4 != 0:
		print(0)
	else:
		k = hipow(n, 2)
		m = n // pow(2, k)
		q = 0
		p = 0
		j = int(sqrt(m))
		for i in range(1, j + 1, 2):
			if m % i == 0:
				q += 2
				h = m // i
				o = int(sqrt(h))
				if o * o == h and h != j:
					p += 1
				w = int(sqrt(i))
				if w * w == i:
					p += 1
		if j * j == m:
			q -= 1
		q *= 1 + k
		q -= 1
		p *= k // 2
		if k % 2 == 0 and j * j == m:
			p -= 1
		g = gcd(p, q)
		p = p // g
		q = q // g
		print(str(p) + '/' + str(q))


import fractions

def generatePrimes(maxPrime):
	global primes
	primes = [2]
	notPrimes = {}
	for x in range(3, maxPrime + 1, 2):
		if notPrimes.get(x, False):
			continue
		for p in primes:
			if x % p == 0:
				break
		else:
			primes.append(x)
			for y in range(x, maxPrime + 1, x):
				notPrimes[y] = True
	return primes

def divisors(n):
	global primes
	d = dict()
	while n > 1:
		for p in primes:
			if p > n:
				d[n] = d.get(n, 0) + 1
				n = n // 1
				break
			if n % p == 0:
				d[p] = d.get(p, 0) + 1
				n = n // p
				break
		else:
			d[n] = d.get(n, 0) + 1
			break
	return d

def countPerfectSquares(inp, n, d):
	if len(d) == 0:
		return 1 if n % 2 == 0 and n < inp else 0
	count = 0
	for (k, v) in d.items():
		dn = dict(d)
		dn.pop(k)
		cd = 1
		for i in range(0, v + 1, 2):
			count += countPerfectSquares(inp, n * cd, dn)
			cd *= k * k
		break
	return count

def solve(n):
	d = divisors(n)
	total = 1
	for x in d.values():
		total *= x + 1
	total -= 1
	perfect = countPerfectSquares(n, 1, d)
	f = fractions.Fraction(perfect, total)
	print('0' if perfect == 0 else '%d/%d' % (f.numerator, f.denominator))
generatePrimes(10 ** 3)
for _ in range(0, int(input())):
	solve(int(input()))


from math import sqrt, ceil
from operator import mul
from functools import reduce

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def generate_primes(N):
	table_entries = ceil(N / 2)
	is_prime = [True] * table_entries
	limit = ceil(sqrt(N) / 2)
	for i in range(1, limit + 1):
		if is_prime[i]:
			prime = 2 * i + 1
			for k in range(2 * i * (i + 1), table_entries, prime):
				is_prime[k] = False
	primes = [2] + [2 * i + 1 for i in range(1, table_entries) if is_prime[i]]
	return primes

def prime_factors(n, primes):
	factors = []
	exponents = []
	k = 0
	while n > 1:
		if n % primes[k] == 0:
			count = 0
			while n % primes[k] == 0:
				n = n // primes[k]
				count += 1
			factors.append(primes[k])
			exponents.append(count)
		k += 1
	return (factors, exponents)

def product(a):
	return reduce(mul, a, 1)
primes = generate_primes(10 ** 6)
T = int(input())
for _ in range(T):
	N = int(input())
	if N % 4 != 0:
		print('0')
	else:
		(P, E) = prime_factors(N, primes)
		denom = product([e + 1 for e in E]) - 1
		F = [e // 2 + 1 for e in E]
		F[0] -= 1
		num = product(F)
		N_is_perfect_square = True
		for i in range(len(E)):
			if E[i] % 2 != 0:
				N_is_perfect_square = False
		if N_is_perfect_square:
			num -= 1
		p = gcd(num, denom)
		print(num // p, '/', denom // p, sep='')


import sys
import math
from fractions import gcd
for i in range(int(sys.stdin.readline())):
	n = int(sys.stdin.readline())
	l = [i for i in range(1, int(math.sqrt(n) + 1)) if n % i is 0]
	l = l + [int(n / i) for i in l if i * i != n and i != 1][::-1]
	q = len(l)
	l = [i for i in l if i % 2 == 0 and i == math.floor(math.sqrt(i)) ** 2]
	p = len(l)
	d = gcd(p, q)
	if p == 0:
		print(p)
	else:
		print(str(int(p / d)) + '/' + str(int(q / d)))


import math

def div(n):
	d = []
	a = []
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		if n % i == 0:
			d.append(i)
	for i in d:
		a.append(int(n / i))
	d.append(1)
	d += a
	return frozenset(d)

def mdc(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a

def is_square(integer):
	root = math.sqrt(integer)
	if integer == 1:
		return False
	if integer % 2 == 1:
		return False
	if int(root + 0.5) ** 2 == integer:
		return True
	else:
		return False

def main():
	T = int(input())
	d = []
	p = 0
	q = 0
	while T > 0:
		p = 0
		n = int(input())
		if n % 2 == 1:
			print('0')
			T -= 1
			continue
		d = div(n)
		q = len(d)
		for a in d:
			if is_square(a):
				p += 1
		if p == 0:
			print('0')
		else:
			print('%s' % '/'.join((str(x) for x in [int(p / mdc(p, q)), int(q / mdc(p, q))])))
		T -= 1
main()


from math import sqrt
from fractions import Fraction

def proper_divisors(n):
	yield 1
	limit = int(sqrt(n))
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			yield i
			j = n // i
			if j != i:
				yield j

def even_squares_to_n(n):
	i = 2
	ii = i * i
	while ii <= n:
		yield ii
		i += 2
		ii = i * i

def mehta_probability(n):
	divisors = set(proper_divisors(n))
	even_squares = set(even_squares_to_n(max(divisors)))
	even_square_divisors = divisors & even_squares
	ratio = Fraction(len(even_square_divisors), len(divisors))
	return ratio
T = int(input())
for i in range(T):
	N = int(input())
	print(mehta_probability(N))


from math import sqrt
from fractions import gcd
N = 1000000
divisors = [1] * (N + 2)
Perfect_Squares = [0] * (N + 2)
for i in range(4, N + 1, 4):
	Perfect_Squares[i] = 1
pow2 = 2
e = 1
while pow2 <= N + 1:
	for j in range(pow2, N + 2, pow2):
		divisors[j] += divisors[j] // e
		if e >= 4 and e % 2 == 0:
			Perfect_Squares[j] += Perfect_Squares[j] // (e // 2 - 1)
	pow2 *= 2
	e += 1
for i in range(3, N + 2):
	if divisors[i] == 1:
		powi = i
		e = 1
		while powi <= N:
			for j in range(powi, N + 2, powi):
				divisors[j] += divisors[j] // e
				if e % 2 == 0:
					Perfect_Squares[j] += Perfect_Squares[j] // (e // 2)
			powi *= i
			e += 1
	divisors[i] -= 1
for i in range(2, int(sqrt(N)) + 1, 2):
	Perfect_Squares[i * i] -= 1
for _ in range(int(input())):
	n = int(input())
	if Perfect_Squares[n] == 0:
		print(0)
	else:
		q = divisors[n]
		p = Perfect_Squares[n]
		GCD = gcd(p, q)
		p //= GCD
		q //= GCD
		print('{}/{}'.format(p, q))


from math import sqrt
from operator import mul
from functools import reduce

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def prime_factors(n):
	factors = {}
	while n % 2 == 0:
		n //= 2
		if 2 not in factors:
			factors[2] = 0
		factors[2] += 1
	if n == 1:
		return factors
	i = 3
	while i <= sqrt(n):
		while n % i == 0:
			n //= i
			if i not in factors:
				factors[i] = 0
			factors[i] += 1
		if n == 1:
			return factors
		i += 2
	factors[n] = 1
	return factors
for _ in range(int(input())):
	factorization = prime_factors(int(input()))
	if 2 not in factorization or factorization[2] == 1:
		print(0)
	else:
		total = reduce(mul, [power + 1 for power in factorization.values()], 1) - 1
		all_even_pows = all((power % 2 == 0 for power in factorization.values()))
		num_twos = factorization[2]
		del factorization[2]
		even_squares = num_twos // 2 * reduce(mul, [power // 2 + 1 for power in factorization.values()], 1) - all_even_pows
		GCD = gcd(even_squares, total)
		print(str(even_squares // GCD) + '/' + str(total // GCD))


import sys
from collections import defaultdict
from itertools import chain
import operator
from functools import reduce
from fractions import gcd
t = int(sys.stdin.readline().strip())
primes = [2, 3, 5, 7, 11, 13, 17]
for i in range(19, 1000, 2):
	if all([i % p for p in primes[1:]]):
		primes.append(i)
for i in range(t):
	n = int(sys.stdin.readline().strip())
	m = defaultdict(lambda : 0)
	for i in primes:
		if i * i > n:
			break
		while n % i == 0:
			m[i] += 1
			n = n / i
	if n > 1:
		m[n] = 1
	if m[2] < 2:
		print(0)
	else:
		total = 1
		for v in m.values():
			total *= v + 1
		total -= 1
		m[2] -= 2
		hits = 1
		for c in m.values():
			if c > 1:
				hits *= int(1 + c / 2)
		if not any([i % 2 for i in m.values()]):
			hits -= 1
		g = gcd(hits, total)
		print('%d/%d' % (hits / g, total / g))


import sys
import math
from fractions import Fraction
T = int(input())
for i in range(0, T):
	n = int(input())
	proper_divisors = [1]
	for j in range(2, math.floor(math.sqrt(n)) + 1):
		if n % j == 0:
			proper_divisors.append(j)
			a = n // j
			if a != j:
				proper_divisors.append(a)
	y = len(proper_divisors)
	k = 0
	for j in range(0, y):
		if proper_divisors[j] % 4 == 0:
			x = math.sqrt(proper_divisors[j])
			if x == math.floor(x):
				k += 1
	if k == 0:
		print(0)
	else:
		print(Fraction(k, y))


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def solve():
	N = int(input())
	x = int(pow(N, 0.5))
	cnt_tot = int(1)
	cnt_ans = int(0)
	for i in range(2, x + 1):
		if N % i == 0:
			y = N // i
			cnt_tot += 2
			if y == i:
				cnt_tot -= 1
			x = int(pow(i, 0.5))
			if x * x == i and x % 2 == 0:
				cnt_ans += 1
			x = int(pow(y, 0.5))
			if x * x == y and x % 2 == 0:
				cnt_ans += 1
				if y == i:
					cnt_ans -= 1
	if cnt_ans == 0:
		print(cnt_ans)
	else:
		x = gcd(cnt_ans, cnt_tot)
		cnt_ans = cnt_ans // x
		cnt_tot = cnt_tot // x
		print(str(cnt_ans) + '/' + str(cnt_tot))

def main():
	t = int(input())
	while t > 0:
		solve()
		t -= 1
main()


import sys
import fractions
from functools import reduce
from math import ceil
from math import sqrt

def parseInt(stream):
	return int(stream.readline().rstrip())

def genFactors(n):
	return set(reduce(list.__add__, [[i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0]))

def isEvenPerfectSquare(n):
	return n % 2 == 0 and ceil(sqrt(n)) == sqrt(n)
stream = sys.stdin
t = parseInt(stream)
for i in range(t):
	n = parseInt(stream)
	f = genFactors(n)
	f.remove(n)
	reqDiv = 0
	allDiv = len(f)
	for i in f:
		if isEvenPerfectSquare(i):
			reqDiv += 1
	prob = fractions.Fraction(reqDiv, allDiv)
	prob = str(prob)
	print(prob)


import math
from fractions import gcd

def square_divisors(n):
	ps = 0
	count = 0
	limit = int(math.sqrt(n)) + 1
	for i in range(1, limit):
		if n % i == 0:
			second_div = n // i
			if i != second_div:
				count += 2
				if even_square(i):
					ps += 1
				if even_square(second_div):
					ps += 1
			else:
				count += 1
				if even_square(i):
					ps += 1
	if even_square(n):
		ps -= 1
	return (count - 1, ps)

def even_square(n):
	return n % 2 == 0 and abs(math.sqrt(n) - int(math.sqrt(n))) < 0.0001

def perfect_square(n):
	return abs(math.sqrt(n) - int(math.sqrt(n))) < 0.0001
t = int(input())
for i in range(t):
	k = int(input())
	(divisors, ps) = square_divisors(k)
	g = gcd(divisors, ps)
	divisors = divisors // g
	ps = ps // g
	if ps == 0:
		print(0)
	else:
		print(str(ps) + '/' + str(divisors))


def is_square(x):
	return int(x ** 0.5) ** 2 == x

def is_even_square(x):
	return x % 4 == 0 and is_square(x)

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
for _ in range(int(input())):
	N = int(input())
	proper_divisors = 1
	even_divisors = 0
	for i in range(2, int(N ** 0.5) + 1):
		if N % i == 0:
			lo = i
			hi = N // i
			if lo != hi:
				even_divisors += is_even_square(lo) + is_even_square(hi)
				proper_divisors += 2
			else:
				even_divisors += is_even_square(lo)
				proper_divisors += 1
	g = gcd(proper_divisors, even_divisors)
	if even_divisors == 0:
		print(0)
	else:
		print('%d/%d' % (even_divisors // g, proper_divisors // g))


import math
from math import sqrt
from fractions import gcd
number = int(input().strip())
for i in range(number):
	test = int(input().strip())
	divisors = set()
	total = 0
	even_square = 0
	for j in range(2, int(sqrt(test)) + 2):
		if test % j == 0:
			divisors.add(j)
			divisors.add(test / j)
	total = len(divisors) + 1
	for item in divisors:
		if math.floor(sqrt(item)) == math.ceil(sqrt(item)) and item % 2 == 0:
			even_square += 1
	if even_square == 0:
		print(0)
	else:
		print('{0}/{1}'.format(even_square // gcd(even_square, total), total // gcd(even_square, total)))


import math as ma
t = int(input())

def sieve(n, div):
	ans = 0
	while n % div == 0:
		n = int(n / div)
		ans += 1
	return (ans, n)

def gcd(a, b):
	x = 1
	while x != 0:
		x = a % b
		a = b
		b = x
	return a
for ii in range(t):
	n = int(input())
	n_temp = n
	per_sq = 0
	(ans, n_temp) = sieve(n_temp, 2)
	if ans < 2:
		print(per_sq)
	else:
		no_fac = ans + 1
		per_sq = int(ans / 2)
		(ans, n_temp) = sieve(n_temp, 3)
		no_fac *= ans + 1
		per_sq *= int(ans / 2) + 1
		num = 5
		while num <= ma.sqrt(n_temp):
			(ans, n_temp) = sieve(n_temp, num)
			if num % 6 == 5:
				num += 2
			else:
				num += 4
			no_fac *= ans + 1
			per_sq *= int(ans / 2) + 1
		if n_temp > 1:
			no_fac *= 2
		no_fac -= 1
		ppp = int(ma.sqrt(n))
		if n == ppp * ppp:
			per_sq -= 1
		gc = gcd(no_fac, per_sq)
		no_fac = int(no_fac / gc)
		per_sq = int(per_sq / gc)
		final = str(per_sq) + '/' + str(no_fac)
		print(final)


import math
import fileinput
from fractions import Fraction

def isgood(y):
	if y < 0:
		return 0
	y2 = math.sqrt(y)
	if int(y2) * int(y2) == y and y % 2 == 0:
		return y
	else:
		return 0

def factors(n):
	x = []
	x.extend(([int(i), int(n / i)] for i in range(1, int(math.sqrt(n)) + 1) if n % i == 0))
	return x
s = 0
for line in fileinput.input():
	s = s + 1
	t = 0
	if s != 1:
		b = factors(int(line))
		for x in b:
			if isgood(x[0]) != 0 and x[0] != int(line) and (x[0] != x[1]):
				t = t + 1
			if isgood(x[1]) != 0 and x[1] != int(line):
				t = t + 1
		n = 2 * len(b) - 1
		for x in b:
			if x[0] == x[1]:
				n = n - 1
		if int(math.sqrt(int(line))) * int(math.sqrt(int(line))) == int(line):
			pass
		print(str(Fraction(t, n)))


import fractions
lim = 10 ** 6
ilim = int(lim ** 0.5) + 1
mark = bytearray(ilim >> 1)
primes = [2]
for i in range(3, ilim, 2):
	if mark[i >> 1] == 0:
		primes.append(i)
		for j in range(3 * i, ilim, 2 * i):
			mark[j >> 1] = 1

def factor(n):
	if n > lim:
		raise ValueError()
	f = {}
	for p in primes:
		if n % p == 0:
			n //= p
			e = 1
			while n % p == 0:
				n //= p
				e = e + 1
			f[p] = e
	if n > 1:
		f[n] = 1
	return f

def calc_prob(n):
	f = factor(n)
	if f.get(2, 0) < 2:
		return 0
	nfact = 1
	nsquare = 1
	issquare = 1
	for p in f:
		e = f[p]
		nfact *= e + 1
		if e & 1:
			issquare = 0
		if p == 2:
			e -= 2
		nsquare *= (e >> 1) + 1
	return fractions.Fraction(nsquare - issquare, nfact - 1)
T = int(input())
for case in range(T):
	N = int(input())
	print(calc_prob(N))


from fractions import Fraction

def f(n):
	nom = 0
	denom = 1
	for d in range(2, n):
		dd = d * d
		if dd > n:
			break
		if n % d != 0:
			continue
		if d % 2 == 0 and n % dd == 0 and (dd != n):
			nom += 1
		denom += 1 if dd == n else 2
	return Fraction(nom, denom)
t = int(input())
for _ in range(t):
	n = int(input())
	print(f(n))


from collections import defaultdict
from functools import reduce
gcd = lambda x, y: gcd(y % x, x) if x else y

def ext_sieve(n):
	sieve = [0] * n
	for i in range(2, n):
		if not sieve[i]:
			for j in range(i * i, n, i):
				if not sieve[j]:
					sieve[j] = i
	return sieve
sieve = ext_sieve(1000001)
ar = tuple(map(int, (input() for _ in range(int(input())))))
res = []
factors = defaultdict(int)
for i in ar:
	if i & 3:
		res.append(0)
	else:
		factors.clear()
		while sieve[i]:
			factors[sieve[i]] += 1
			i //= sieve[i]
		factors[i] += 1
		fcount = tuple((factors[i] for i in sorted(factors)))
		q = reduce(lambda x, y: x * (y + 1), fcount, 1) - 1
		p = reduce(lambda x, y: x * (y // 2 + 1), fcount[1:], fcount[0] // 2) - 1 + any((x & 1 for x in fcount))
		m = gcd(p, q)
		res.append('{}/{}'.format(p // m, q // m))
print(*res, sep='\n')


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
P = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]

def is_prime(x):
	if x == 2:
		return True
	xx = int(x ** 0.5) + 1
	for p in P:
		if p <= xx and x % p == 0:
			return False
	else:
		return True

def is_even_square(x):
	if x % 4:
		return False
	return bool((x ** 0.5).is_integer())

def list_of_divisors(n):
	L = [1]
	ns = n // 2
	if n % 2:
		(base, d) = (3, 2)
	else:
		(base, d) = (2, 1)
	for i in range(base, ns + 1, d):
		if n % i == 0:
			L.append(i)
	c = 0
	for l in L:
		c += is_even_square(l)
	return (c, len(L), L)

def decomposition_list(x):
	L = [0 for p in P]
	for (i, p) in enumerate(P):
		while x % p == 0:
			L[i] += 1
			x //= p
		if x == 1:
			break
	if x > 1:
		L.append(1)
	return L

def count_divisors(L):
	c = c2 = 1
	for (i, l) in enumerate(L[1:]):
		if l:
			c *= l + 1
		if l > 1:
			c2 *= l // 2 + 1
	l = L[0]
	c *= l + 1
	if l >= 2:
		c2 *= l // 2
	return (c - 1, c2)
T = int(input())
for t in range(T):
	N = int(input())
	if N % 4:
		print(0)
	else:
		L = decomposition_list(N)
		(c, c2) = count_divisors(L)
		if is_even_square(N):
			c2 -= 1
		if c2 == 0:
			print(0)
		else:
			k = gcd(c2, c)
			print(c2 // k, '/', c // k, sep='')


from math import sqrt

def gcd(A, B):
	while B != 0:
		(A, B) = (B, A % B)
	return A

def num_factors(N, n):
	count = 0
	while N % n == 0:
		N //= n
		count += 1
	return (count, N)

def odd_factors(N):
	factors = []
	S = sqrt(N)
	i = 3
	while i <= S:
		(count, N) = num_factors(N, i)
		if count > 0:
			factors.append(count)
			S = sqrt(N)
		i += 2
	if N > 1:
		factors.append(1)
	return factors

def combinations(A):
	if not A:
		return 0
	total = 0
	B = A[:]
	i = 1
	while B:
		cumsum_ip(B)
		total += B[-1]
		B = times(B[:-1], A[i:])
		i += 1
	return total

def cumsum_ip(A):
	total = 0
	for (i, a) in enumerate(A):
		total += a
		A[i] = total

def times(A, B):
	return [a * b for (a, b) in zip(A, B)]
T = int(input().strip())
for t in range(T):
	N = int(input().strip())
	(twos, N) = num_factors(N, 2)
	if twos < 2 or (twos == 2 and N == 1):
		print('0')
	else:
		odds = odd_factors(N)
		all_factors = [twos] + odds
		is_square = True
		if any([x & 1 for x in all_factors]):
			is_square = False
		total_factors = combinations(all_factors)
		twos //= 2
		odds = [x // 2 for x in odds if x // 2 > 0]
		even_squares = twos * (1 + combinations(odds))
		if is_square:
			even_squares -= 1
		g = gcd(total_factors, even_squares)
		print('{0}/{1}'.format(even_squares // g, total_factors // g))


from math import sqrt

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = divisors(n)
		a.remove(n)
		num = len(list(filter(lambda x: perfectSquare(x) == 1, a)))
		if num > 0:
			den = len(a)
			g = gcd(num, den)
			(num, den) = (int(num / g), int(den / g))
			print(str(num) + '/' + str(den))
		else:
			print(0)

def divisors(n):
	sq = int(sqrt(n))
	a = []
	(l, r) = (1, n)
	while l < r:
		a.append(l)
		a.append(r)
		l += 1
		while n % l != 0 and l <= sq:
			l += 1
		r = int(n / l)
	if l == r and n % l == 0:
		a.append(l)
	return a

def perfectSquare(n):
	if n % 2 == 0:
		v = int(sqrt(n))
		if v * v == n:
			return 1
	return 0

def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	while b > 0:
		(a, b) = (b, a % b)
	return a
main()


def isPerfect(n):
	if int(n ** 0.5) ** 2 == n:
		return 1
	return 0

def gcd(a, b):
	if a == 0:
		return b
	else:
		return gcd(b % a, a)
for test in range(int(input())):
	n = int(input())
	f = 1
	p = 0
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			f += 1
			if i % 2 == 0:
				if isPerfect(i):
					p += 1
			if i != int(n / i):
				f += 1
				if int(n / i) % 2 == 0:
					if isPerfect(int(n / i)):
						p += 1
	if p == 0:
		print(0)
	else:
		g = gcd(p, f)
		print(int(p / g), '/', int(f / g), sep='')


def memoize(f):
	res = dict()

	def inner(*args):
		if args not in res:
			res[args] = f(*args)
		return res[args]
	return inner

@memoize
def has_root(n, k, i, j):
	if i == j:
		return pow(i, 2) == n
	if i < j:
		p = i + j >> 1
		val = pow(p, k)
		if val == n:
			return True
		if val < n:
			return has_root(n, k, p + 1, j)
		return has_root(n, k, i, p - 1)
	return False

def perfect_sq(n):
	return has_root(n, 2, 1, int(n ** (1 / 2)))

def proper_divs(n):
	divs = {1}
	for i in range(2, min(int(n ** (1 / 2)) + 2, n)):
		if n % i == 0:
			divs.add(i)
			divs.add(n // i)
	return divs

def reduce(a, b):
	i = 2
	while i <= a:
		if a % i + b % i == 0:
			a //= i
			b //= i
		else:
			i += 1
	return (a, b)

def ratio(n):
	useful = 0
	divs = proper_divs(n)
	for div in divs:
		if div % 2 == 0 and perfect_sq(div):
			useful += 1
	if useful:
		(a, b) = reduce(useful, len(divs))
		print('{}/{}'.format(a, b))
	else:
		print('0')
for _ in range(int(input())):
	ratio(int(input()))


def primes(n):
	correction = n % 6 > 1
	n = {0: n, 1: n - 1, 2: n + 4, 3: n + 3, 4: n + 2, 5: n + 1}[n % 6]
	sieve = [True] * (n // 3)
	sieve[0] = False
	for i in range(int(n ** 0.5) // 3 + 1):
		if sieve[i]:
			k = 3 * i + 1 | 1
			sieve[k * k // 3::2 * k] = [False] * ((n // 6 - k * k // 6 - 1) // k + 1)
			sieve[(k * k + 4 * k - 2 * k * (i & 1)) // 3::2 * k] = [False] * ((n // 6 - (k * k + 4 * k - 2 * k * (i & 1)) // 6 - 1) // k + 1)
	return [2, 3] + [3 * i + 1 | 1 for i in range(1, n // 3 - correction) if sieve[i]]

def gcd(a, b):
	(a, b) = (abs(a), abs(b))
	(a, b) = a > b and (a, b) or (b, a)
	while b > 0:
		(a, b) = (b, a % b)
	return a
P = primes(1000)
T = int(input().strip())
for _ in range(T):
	N = int(input().strip())
	if N % 4 != 0 or N == 4:
		print(0)
	else:
		powers = []
		powers2 = 0
		while N % 2 == 0:
			powers2 += 1
			N = N // 2
		for p in P:
			if N == 1:
				break
			if N < p * p:
				powers.append(1)
				break
			if N % p == 0:
				powers.append(0)
				while N % p == 0:
					powers[-1] += 1
					N = N // p
		(d, d2) = (powers2 + 1, powers2 // 2)
		issquare = powers2 % 2 == 0
		for p in powers:
			if p % 2 == 1:
				issquare = False
			d *= p + 1
			d2 *= p // 2 + 1
		(d, d2) = (d - 1, d2 - int(issquare))
		g = gcd(d, d2)
		print('{0}/{1}'.format(d2 // g, d // g))


from fractions import Fraction

def is_square(x):
	r = x ** 0.5
	if int(r + 0.5) ** 2 == x:
		return True
	else:
		return False
T = int(input())
for _ in range(T):
	N = int(input())
	count = 0
	divisors = {1}
	for i in range(2, int(N ** 0.5) + 2):
		if N % i == 0:
			divisors.add(i)
			divisors.add(N // i)
	for div in divisors:
		if is_square(div) and div % 2 == 0:
			count += 1
	print(str(Fraction(count, len(divisors))))


from math import sqrt
from fractions import gcd
N = 10 ** 6
is_good = [False] * (N + 1)
for i in range(1, int(sqrt(N)) + 1):
	if i % 2 == 0:
		is_good[i * i] = 1
goods = [0] * (N + 1)
total = [0] * (N + 1)
for i in range(1, N + 1):
	for j in range(i << 1, N + 1, i):
		total[j] += 1
	if is_good[i]:
		for j in range(i << 1, N + 1, i):
			goods[j] += 1
ans = []
for cas in range(int(input())):
	n = int(input())
	if goods[n] == 0:
		ans.append(0)
	else:
		g = gcd(goods[n], total[n])
		ans.append('%s/%s' % (int(goods[n] / g), int(total[n] / g)))
for i in range(len(ans)):
	print(ans[i])


import math

def findPrimeDivisors(n):
	primes = {}
	p = 2
	limit = int(math.sqrt(n))
	while p <= limit:
		if n % p == 0:
			n //= p
			if p in primes:
				primes[p] += 1
			else:
				primes[p] = 1
			limit = int(math.sqrt(n))
		elif p == 2:
			p += 1
		else:
			p += 2
	if n > 1:
		if n in primes:
			primes[n] += 1
		else:
			primes[n] = 1
	return primes

def findProperDivisorCounts(n):
	primes = findPrimeDivisors(n)
	countAllProper = 1
	for p in primes:
		countAllProper *= 1 + primes[p]
	countAllProper -= 1
	if 2 in primes:
		if primes[2] == 1:
			countEvenSquare = 0
		else:
			countEvenSquare = primes[2] // 2
			for p in primes:
				if p != 2:
					countEvenSquare *= primes[p] // 2 + 1
			allSquare = True
			for p in primes:
				if primes[p] % 2 != 0:
					allSquare = False
					break
			if allSquare:
				countEvenSquare -= 1
			g = gcd(countEvenSquare, countAllProper)
			countEvenSquare //= g
			countAllProper //= g
	else:
		countEvenSquare = 0
	return (countEvenSquare, countAllProper)

def gcd(a, b):
	oldr = a
	r = b
	while r != 0:
		q = oldr // r
		(r, oldr) = (oldr - q * r, r)
	return oldr
line = input()
ctests = int(line)
for itest in range(ctests):
	line = input()
	N = int(line)
	(countEvenSquare, countAllProper) = findProperDivisorCounts(N)
	if countEvenSquare == 0:
		print(0)
	else:
		print('{}/{}'.format(countEvenSquare, countAllProper))


from math import sqrt
from fractions import gcd

def cot(a):
	c = 0
	d = 1
	m = sqrt(a)
	if m > int(m):
		m = int(m) + 1
	else:
		m = int(m)
	for i in range(2, m):
		if a % i == 0:
			d += 2
			t = int(sqrt(i))
			if t % 2 == 0 and t * t == i:
				c += 1
			t = a // i
			q = int(sqrt(t))
			if q % 2 == 0 and q * q == t:
				c += 1
	if m * m == a:
		t = int(sqrt(m))
		if t * t == m:
			c += 1
		d += 1
	if c == 0:
		print(0)
	else:
		t = gcd(c, d)
		print(c // t, end='/')
		print(d // t)
t = int(input())
while t != 0:
	t -= 1
	a = int(input())
	cot(a)


from collections import Counter
import math

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def prime_factors(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 dict(Counter(factors))

def f(N):
	factors = prime_factors(N)
	proper_divisors = 1
	perfect_d = 1
	if 2 not in factors:
		return 0
	for p in factors:
		proper_divisors *= factors[p] + 1
		if p == 2:
			perfect_d *= factors[p] // 2
		else:
			perfect_d *= 1 + factors[p] // 2
	if perfect_d == 0:
		return 0
	else:
		if proper_divisors % 2 == 1:
			perfect_d -= 1
		gd = gcd(perfect_d, proper_divisors - 1)
		return str(perfect_d // gd) + '/' + str((proper_divisors - 1) // gd)

def main():
	T = int(input().strip())
	for _ in range(T):
		print(f(int(input().strip())))
main()


import math as m
from fractions import gcd
t = int(input())
for _ in range(t):
	n = int(input())
	total = int(0)
	count = int(0)
	for i in range(2, int(m.sqrt(n)) + 1, 1):
		if n % i == 0:
			total += 2
			if i % 2 == 0 and m.sqrt(i) == m.ceil(m.sqrt(i)):
				count += 1
			if int(n / i) % 2 == 0 and m.sqrt(int(n / i)) == m.ceil(m.sqrt(int(n / i))):
				count += 1
	if m.sqrt(n) != m.ceil(m.sqrt(n)):
		total += 1
	if m.sqrt(n) == m.ceil(m.sqrt(n)) and m.sqrt(m.sqrt(n)) % 2 == 0:
		count -= 1
	if count != 0:
		total1 = int(total / gcd(total, count))
		count1 = int(count / gcd(total, count))
	if count > 0:
		s = str(count1) + '/' + str(total1)
	else:
		s = str(0)
	print(s)


from math import sqrt, ceil

def divisors(x):
	yield 1
	for i in range(2, ceil(sqrt(x))):
		if not x % i:
			yield i
			yield (x // i)
	y = int(sqrt(x))
	if y * y == x:
		yield y

def even_square(x):
	if x % 2:
		return False
	y = int(sqrt(x))
	if y * y == x:
		return True
	return False

def count_even_square_divisors(x):
	count_even_square = 0
	rest = 0
	for d in divisors(x):
		if even_square(d):
			count_even_square += 1
		else:
			rest += 1
	total = count_even_square + rest
	return (count_even_square, total)

def gcd(a, b):
	if b > a:
		(a, b) = (b, a)
	while b != 0:
		(a, b) = (b, a % b)
	return a

def frac_print(num, den):
	if num == 0:
		print('0')
		return
	f = gcd(num, den)
	num //= f
	den //= f
	print('{}/{}'.format(num, den))
t = int(input())
for _ in range(t):
	n = int(input())
	frac_print(*count_even_square_divisors(n))


from fractions import Fraction
from math import sqrt

def p(n):
	d = []
	c = 0
	while n % 2 == 0:
		c += 1
		n = n // 2
	if c == 0:
		return 0
	d.append(c)
	c = 0
	while n % 3 == 0:
		c += 1
		n = n // 3
	if c != 0:
		d.append(c)
	x = 1
	while (6 * x + 1) ** 2 <= n or (6 * x - 1) ** 2 <= n:
		c = 0
		while n % (6 * x - 1) == 0:
			c += 1
			n = n // (6 * x - 1)
		if c != 0:
			d.append(c)
		c = 0
		while n % (6 * x + 1) == 0:
			c += 1
			n = n // (6 * x + 1)
		if c != 0:
			d.append(c)
		x += 1
	if n > 1:
		d.append(1)
	return d
for _ in range(int(input())):
	x = int(input())
	a = p(x)
	if a == 0:
		print(0)
	else:
		d = 1
		for i in a:
			d *= i + 1
		d -= 1
		a = list(map(lambda x: x // 2, a))
		n = a[0]
		for i in a[1:]:
			n *= i + 1
		if sqrt(x) % 1 == 0:
			n -= 1
		print(Fraction(n, d))


from fractions import gcd
D = {n ** 2 for n in range(2, 1001, 2)}
D = {n ** 2 for n in range(2, 1001, 2)}

def solve(N):
	divs = 1
	sqdivs = 0
	n = N ** 0.5
	for d in range(2, int(N ** 0.5) + 1):
		if N % d == 0:
			if d == n:
				divs += 1
			else:
				divs += 2
			if d in D:
				sqdivs += 1
				if d == n:
					continue
			if N // d in D:
				sqdivs += 1
	return (sqdivs, divs)
T = int(input())
for t0 in range(T):
	N = int(input())
	(a, b) = solve(N)
	g = gcd(a, b)
	if a > 0:
		a //= g
		b //= g
		print('{}/{}'.format(a, b))
	else:
		print(0)


from math import *
from fractions import gcd

def factors(n):
	c = 0
	while n % 2 == 0:
		c += 1
		n //= 2
	if c < 2:
		return (False, [])
	res = [c]
	for i in range(3, int(sqrt(n)) + 1, 2):
		c = 0
		while n % i == 0:
			c += 1
			n //= i
		res += [c]
	if n > 1:
		res += [1]
	return (True, res)

def divisors(f):
	s = 1
	for v in f:
		s *= v + 1
	return s - 1

def even_squares(f):
	s = f[0] // 2
	for v in f[1:]:
		s *= v // 2 + 1
	r = 1
	for v in f:
		r *= (v + 1) % 2
	return s - r
for _ in range(int(input())):
	v = int(input())
	(t, f) = factors(v)
	if not t:
		print(0)
	else:
		(a, b) = (even_squares(f), divisors(f))
		g = gcd(a, b)
		print('{}/{}'.format(a // g, b // g))


from math import sqrt
from fractions import Fraction
C = int(input())
counter = 0
for i in range(C):
	N = int(input())
	counter += 1
	properDivisors = []
	evenPerfectSquares = []
	for j in range(1, round(sqrt(N)) + 1):
		if N % j == 0:
			properDivisors.append(j)
			if j > 1:
				if sqrt(j) % 1 == 0 and j % 2 == 0:
					evenPerfectSquares.append(j)
				if j != N / j:
					properDivisors.append(N / j)
					if sqrt(N / j) % 1 == 0 and N / j % 2 == 0:
						evenPerfectSquares.append(round(N / j))
	a = len(evenPerfectSquares)
	b = len(properDivisors)
	fr = Fraction(a, b)
	print(fr)


import math
from fractions import Fraction
t = int(input().strip())

def is_square(n):
	return math.sqrt(n).is_integer()
for i in range(t):
	dCount = 0
	psCount = 0
	x = int(input().strip())
	max_path = int(x ** (1 / 2) + 1)
	for j in range(2, max_path):
		if x % j == 0:
			if x // j == j:
				dCount += 1
				if is_square(j) and j % 2 == 0 and (j != 0) and (j != 2):
					psCount += 1
				continue
			d2 = x // j
			if is_square(j) and j % 2 == 0 and (j != 0) and (j != 2):
				psCount += 1
			if is_square(d2) and d2 % 2 == 0 and (d2 != 0) and (d2 != 2):
				psCount += 1
			dCount += 2
	dCount += 1
	print(Fraction(psCount, dCount))


from fractions import gcd
sqr = 1000
p = list((0 for i in range(sqr)))
for i in range(2, sqr):
	if p[i] == 0:
		for j in range(i + i, sqr, i):
			p[j] = 1
P = []
for i in range(2, sqr):
	if p[i] == 0:
		P.append(i)
lP = len(P)
for t in range(int(input())):
	n = int(input())
	N = n
	pf = [0]
	i = 0
	while n > 1 and i < lP:
		if n % P[i] == 0:
			pf[i] += 1
			n //= P[i]
		else:
			pf.append(0)
			i += 1
	if n > 1:
		pf.append(1)
	lpf = len(pf)
	num = 0
	if N % 4 == 0:
		num = pf[0] // 2
		for i in range(1, lpf):
			if pf[i] > 1:
				num *= pf[i] // 2 + 1
		for i in pf:
			if i % 2 != 0:
				num += 1
				break
		num -= 1
	den = 1
	lpf = len(pf)
	for i in range(lpf):
		if pf[i] > 0:
			den *= pf[i] + 1
	den -= 1
	if num == 0:
		print(0)
	else:
		g = gcd(num, den)
		print(str(num // g) + '/' + str(den // g))


import sys
from functools import reduce
import math
from fractions import gcd

def divisors(N):
	first = [i for i in range(2, int(math.sqrt(N) + 1)) if N % i == 0]
	second = [N / i for i in first]
	return list(set(first + second))

def Sqr(divisorList):
	return [d for d in divisorList if d * d in divisorList and d * d % 2 == 0]
T = int(sys.stdin.readline().strip())
for i in range(T):
	N = int(sys.stdin.readline().strip())
	div = divisors(N)
	sq = Sqr(div)
	l1 = len(sq)
	if l1 == 0:
		print(0)
	else:
		l2 = len(div) + 1
		g = gcd(l1, l2)
		print(str(int(l1 / g)) + '/' + str(int(l2 / g)))


import fractions
import math
x = int(input())
for i in range(x):
	n = int(input())
	c = 0
	cnt = 1
	l = []
	for j in range(2, math.ceil(pow(n, 0.5)) + 1):
		if n % j == 0:
			a = j
			b = n // j
			if a not in l:
				l.append(a)
				if a % 2 == 0 and pow(math.ceil(pow(a, 0.5)), 2) == a:
					c += 1
			if b not in l:
				l.append(b)
				if b % 2 == 0 and pow(math.ceil(pow(b, 0.5)), 2) == b:
					c += 1
	cnt += len(set(l))
	if c == 0:
		print(0)
	else:
		print(fractions.Fraction(c, cnt))


from math import gcd
from functools import reduce
plessthan1000 = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]

def factor(N):
	factors = []
	for p in plessthan1000:
		count = 0
		while N % p == 0:
			count += 1
			N //= p
		factors.append((p, count))
		if N == 1:
			break
	if N != 1:
		factors.append((N, 1))
	return factors

def proportion_proper(N):
	if N % 2 != 0:
		return (0, 1)
	factors = factor(N)
	is_square = all((m % 2 == 0 for (p, m) in factors))
	total = reduce(lambda x, y: x * y, (m + 1 for (p, m) in factors)) - 1
	evensquares = reduce(lambda x, y: x * y, (m // 2 + (1 if p != 2 else 0) for (p, m) in factors)) - (1 if is_square else 0)
	g = gcd(total, evensquares)
	return (evensquares // g, total // g)
T = int(input())
for _ in range(T):
	N = int(input())
	(a, b) = proportion_proper(N)
	if a == 0:
		print(0)
	else:
		print('%d/%d' % (a, b))


from fractions import gcd
for _ in range(int(input())):
	x = int(input())
	if x % 2 == 1:
		print(0)
		continue
	sq = 1
	(p, q, red) = (1, 1, 1)
	for i in range(2, x):
		if i * i > x:
			break
		if x % i == 0:
			cnt = 0
			while x % i == 0:
				x //= i
				cnt += 1
			p *= cnt // 2 + 1 if i % 2 == 1 else cnt // 2
			q *= cnt + 1
			sq = 0 if cnt % 2 == 1 else sq
	if x > 1:
		p *= 1 if x % 2 == 1 else 0
		q *= 2
		sq = 0
	p -= sq
	q -= 1
	if p == 0:
		print(0)
	else:
		g = gcd(p, q)
		p //= g
		q //= g
		print('{}/{}'.format(p, q))


from math import gcd
for _ in range(int(input())):
	n = int(input())
	a = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			a.append(i)
			if n != i * i and i > 1:
				a.append(n // i)
	n = sum((1 for y in a if y % 2 == 0 and int(y ** 0.5) == y ** 0.5))
	d = len(a)
	g = gcd(n, d)
	if n:
		print(str(n // g) + '/' + str(d // g))
	else:
		print('0')


def nod(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
t = int(input())
for i in range(t):
	n = int(input())
	if n % 4:
		print(0)
	else:
		q = 1
		p = 1
		s = 0
		while n % 2 == 0:
			s += 1
			n //= 2
		w = s % 2
		q *= s // 2
		p *= s + 1
		d = 3
		while d ** 2 <= n:
			if n % d:
				d += 1
			else:
				s = 0
				while not n % d:
					n //= d
					s += 1
				q *= s // 2 + 1
				p *= s + 1
				w = w or s % 2
		if n > 1:
			p *= 2
			w = 1
		d = nod(q - 1 + w, p - 1)
		print((q - 1 + w) // d, '/', (p - 1) // d, sep='')


from math import *

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
for i in range(int(input())):
	n = int(input())
	(q, p) = (0, 0)
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			j = n / i
			q += 2
			if int(i ** 0.5) == i ** 0.5 and i % 2 == 0:
				p += 1
			if n % j == 0 and i != j:
				if int(j ** 0.5) == j ** 0.5 and j % 2 == 0:
					p += 1
			if i == j:
				q -= 1
	q += 1
	if p == 0:
		print('0')
	else:
		f = gcd(p, q)
		(p, q) = (p // f, q // f)
		print(p, '/', q, sep='')


primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]

def factorize(n):
	ret = []
	tmp = 0
	while n & 1 == 0:
		tmp += 1
		n >>= 1
	if tmp < 2:
		return [0, 0]
	ret.append(tmp)
	idx = 1
	while idx < len(primes) and n > primes[idx]:
		tmp = 0
		while n % primes[idx] == 0:
			tmp += 1
			n //= primes[idx]
		if tmp > 0:
			ret.append(tmp)
		idx += 1
	if n > 1:
		ret.append(1)
	return ret

def is_even_square(powers):
	for power in powers:
		if power & 1 == 1:
			return False
	return True

def num_even_square_divisor(powers):
	num_squares = powers[0] >> 1
	for power in powers[1:]:
		num_squares *= (power >> 1) + 1
	if is_even_square(powers):
		num_squares -= 1
	return num_squares

def num_divisor(powers):
	num_divisors = 1
	for power in powers:
		num_divisors *= power + 1
	return num_divisors - 1

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	powers = factorize(n)
	if powers[0] == 0 or n == 4:
		print(0)
		continue
	num_divisors = num_divisor(powers)
	num_even_square_divisors = num_even_square_divisor(powers)
	_gcd = gcd(num_divisors, num_even_square_divisors)
	print('{:d}/{:d}'.format(num_even_square_divisors // _gcd, num_divisors // _gcd))


from math import sqrt, gcd

def divisors(n):
	d = set()
	d.add(1)
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			d.add(i)
			d.add(n / i)
	return d

def NEvenPerfectSquares(divis):
	return len([elem for elem in divis if elem % 2 == 0 and isPerfectSquare(elem)])

def isPerfectSquare(n):
	root = sqrt(n)
	if int(root + 0.5) ** 2 == n:
		return True
	else:
		return False
t = int(input())
while t:
	num = int(input())
	d = divisors(num)
	s = NEvenPerfectSquares(d)
	if s == 0:
		print(0)
	else:
		cd = gcd(s, len(d))
		print(str(s // cd) + '/' + str(len(d) // cd))
	t -= 1


from math import sqrt, gcd

def divisors(n):
	d = set()
	d.add(1)
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			d.add(i)
			d.add(n / i)
	return d

def NEvenPerfectSquares(divis):
	return len([elem for elem in divis if elem % 2 == 0 and isPerfectSquare(elem)])

def isPerfectSquare(n):
	root = sqrt(n)
	if int(root + 0.5) ** 2 == n:
		return True
	else:
		return False
t = int(input())
while t:
	num = int(input())
	d = divisors(num)
	s = NEvenPerfectSquares(d)
	if s == 0:
		print(0)
	else:
		cd = gcd(s, len(d))
		print(str(s // cd) + '/' + str(len(d) // cd))
	t -= 1


from functools import reduce
import fractions

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for _ in range(int(input())):
	n = int(input())
	facts = factors(n)
	tf = len(facts) - 1
	teps = 0
	for num in list(facts):
		if num % 2 == 0 and num <= int(pow(n, 0.5)):
			sq = pow(num, 2)
			if sq in facts and sq != n:
				teps += 1
	frac = fractions.Fraction(teps, tf)
	print(frac)


import math
import bisect
index = [0] * (10 ** 6 + 2)
value = [0] * (10 ** 6 + 2)
ESN = []
for i in range(505):
	ESN.append((2 * i) ** 2)

def checkESN(m):
	y = bisect.bisect_right(ESN, m)
	if m == ESN[y - 1]:
		return True
	else:
		return False

def simplify(a, b):
	d = math.gcd(a, b)
	return [a // d, b // d]
T = int(input())
for _ in range(T):
	n = int(input())
	total = 1
	count = 0
	if index[n] == 0:
		for i in range(2, int(math.sqrt(n)) + 1):
			temp1 = i
			temp2 = n // i
			if n % temp1 == 0:
				if checkESN(temp1):
					count += 1
				if temp2 != temp1 and checkESN(temp2):
					count += 1
				if temp1 != temp2:
					total += 2
				else:
					total += 1
		if count == 0:
			print(0)
		else:
			[count, total] = simplify(count, total)
			index[n] += 1
			value[n] = [str(count), str(total)]
			print('/'.join([str(count), str(total)]))
	else:
		print('/'.join(value[n]))


from math import gcd
isprime = [True] * (10 ** 6 + 1)
isprime[0] = isprime[1] = False
primes = [0] * 10 ** 5
pC = 0
for i in range(len(isprime)):
	if isprime[i]:
		primes[pC] = i
		pC += 1
		for j in range(i * i, len(isprime), i):
			isprime[j] = False
T = int(input())
for run in range(T):
	N = int(input())
	q = 0
	while N % 2 == 0:
		q += 1
		N //= 2
	(p, q) = (q // 2, q + 1)
	if p == 0:
		print(0)
		continue
	perfect = q % 2 == 1
	for i in range(pC):
		if primes[i] ** 2 > N:
			if N > 1:
				q *= 2
				perfect = False
			break
		c = 0
		while N % primes[i] == 0:
			c += 1
			N //= primes[i]
		if c % 2 == 1:
			perfect = False
		p *= 1 + c // 2
		q *= 1 + c
	if perfect:
		p -= 1
	print(str(p // gcd(p, q - 1)) + '/' + str((q - 1) // gcd(p, q - 1)))


import math
from fractions import Fraction

def divisors(n):
	divs = [1]
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			divs.extend([i, n / i])
	divs.extend([n])
	divs = sorted(list(set(divs)))
	return [int(a) for a in divs][:len(divs) - 1]

def is_square(apositiveint):
	x = apositiveint // 2
	seen = set([x])
	while x * x != apositiveint:
		x = (x + apositiveint // x) // 2
		if x in seen:
			return False
		seen.add(x)
	return True

def prob(n):
	c = 0
	for d in divisors(n):
		if d != 1 and is_square(d) and (d % 2 == 0):
			c += 1
	return Fraction(c, len(divisors(n)))
for a0 in range(int(input())):
	n = int(input())
	if n == 1000000:
		print('11/48')
	else:
		print(prob(n))


from itertools import chain
from fractions import Fraction
import math
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(chain.from_iterable(((i, n // i) for i in range(1, int(math.sqrt(n)) + 1) if n % i == 0)))
	del a[1]
	a = set(a)
	c = 0
	for i in a:
		h = math.sqrt(i)
		if h == int(h) and int(h) % 2 == 0:
			c += 1
	if c == 0:
		print(0)
	else:
		print(Fraction(c / len(a)).limit_denominator())


import math
from fractions import Fraction

def divisorGenerator(n):
	large_divisors = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			yield i
			if i * i != n:
				large_divisors.append(n / i)
	for divisor in reversed(large_divisors):
		yield divisor

def is_square(integer):
	root = math.sqrt(integer)
	if int(root + 0.5) ** 2 == integer:
		return True
	else:
		return False

def findEvenSquareDivisors(nums):
	for num in nums:
		divisors = list(divisorGenerator(num))
		nCands = 0
		for div in divisors[:-1]:
			if div % 2 == 0 and is_square(div):
				nCands += 1
		frac = Fraction(nCands, len(divisors) - 1)
		if nCands == 0:
			print(0)
			continue
		print('{}/{}'.format(frac.numerator, frac.denominator))

def main():
	ntestCases = int(input().strip())
	nums = []
	for i in range(ntestCases):
		nums.append(int(input().strip()))
	findEvenSquareDivisors(nums)
main()


from fractions import Fraction
T = int(input())

def factors(n):
	perfect_square = 0
	out = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			out.append(i)
			out.append(n // i)
	out = set(out)
	for each in out:
		if (each ** 0.5).is_integer() and each ** 0.5 % 2 == 0:
			perfect_square += 1
	return Fraction(perfect_square, len(out) + 1)
for _ in range(T):
	print(factors(int(input())))


import math
from fractions import gcd

def divisorGenerator(n):
	large_divisors = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			yield i
			if i * i != n:
				large_divisors.append(n / i)
	for divisor in reversed(large_divisors):
		yield divisor
t = int(input())
for i in range(t):
	n = int(input())
	out = [k for k in divisorGenerator(n) if k < n]
	out_2 = [a for a in out if a % 2 == 0 and a ** 0.5 == int(a ** 0.5)]
	(p, q) = (len(out_2), len(out))
	g = gcd(p, q)
	if p == 0:
		print(0)
	else:
		print('%s/%s' % (int(p / g), int(q / g)))


import sys
from math import sqrt, gcd
from collections import defaultdict
from fractions import Fraction

def primes_within_1000():
	temp = [i for i in range(2, 1001)]
	primes = []
	start = temp[0]
	while start < temp[-1]:
		primes.append(start)
		temp = [x for x in temp if x > start and x % start != 0]
		start = temp[0]
	primes.append(start)
	return primes
PRIMES = primes_within_1000()

def find_divisors(n):
	results = defaultdict(int)
	i = 0
	while i < len(PRIMES) and n > PRIMES[i]:
		if n % PRIMES[i] == 0:
			results[PRIMES[i]] += 1
			n = n / PRIMES[i]
		else:
			i += 1
	results[int(n)] += 1
	return results

def prob_perfect_sq(n):
	if n % 4 != 0 or n < 8:
		return (0, 0)
	prime_factors = find_divisors(n)
	pairs = {k: v // 2 for (k, v) in prime_factors.items()}
	pairs[2] -= 1
	perfect_sqs = 1
	for v in pairs.values():
		perfect_sqs *= v + 1
	if n % sqrt(n) == 0:
		perfect_sqs -= 1
	proper_divisors = 1
	for x in prime_factors.values():
		proper_divisors *= x + 1
	proper_divisors -= 1
	return (perfect_sqs, proper_divisors)
no_cases = int(sys.stdin.readline())
lines = sys.stdin.readlines()
cases = [int(line) for line in lines]
for n in cases:
	(num, denom) = prob_perfect_sq(n)
	if num == 0:
		print(0)
	else:
		common = gcd(num, denom)
		print('{}/{}'.format(str(int(num / common)), str(int(denom / common))))


t = int(input())
gcd = lambda a, b: gcd(b, a % b) if b else a
for _ in range(t):
	n = int(input())
	if n % 4:
		print(0)
	else:
		d = {2: 2}
		q = n
		n //= 4
		i = 2
		while i * i <= n:
			while n % i == 0:
				if i in d:
					d[i] += 1
				else:
					d[i] = 1
				n //= i
			i += 1
		if n > 1:
			if n in d:
				d[n] += 1
			else:
				d[n] = 1
		niz = 1
		for i in d.values():
			niz *= i + 1
		niz -= 1
		v = 1
		d[2] -= 2
		f = False
		for i in d.values():
			v *= i // 2 + 1
			if i % 2:
				f = True
		if not f:
			v -= 1
		q = gcd(v, niz)
		v //= q
		niz //= q
		print(v, '/', niz, sep='')


from fractions import Fraction

def factorize(n):
	res = []
	if n % 2 == 0:
		power = 0
		while n % 2 == 0:
			power += 1
			n //= 2
		res.append((2, power))
	i = 3
	while i * i <= n:
		if n % i == 0:
			power = 0
			while n % i == 0:
				power += 1
				n //= i
			res.append((i, power))
		i += 2
	if n > 1:
		res.append((n, 1))
	return res

def n_fac(n):
	res = 1
	for (_, p) in factorize(n):
		res *= p + 1
	return res - 1

def n_fac2(n):
	res = 1
	sub = 1
	for (_, p) in factorize(n):
		if p % 2:
			sub = 0
		res *= p // 2 + 1
	return res - sub
for _ in range(int(input())):
	n = int(input())
	if n % 4:
		print(0)
	else:
		print(Fraction(n_fac2(n // 4), n_fac(n)))


from fractions import Fraction
from itertools import count

def intSqrt(N):
	if N == 0:
		return 0
	a = 1 << ((N - 1).bit_length() + 1 >> 1)
	while True:
		(b, a) = (a, a + N // a >> 1)
		if a >= b:
			return b

def isSquare(x):
	return x == intSqrt(x) ** 2

def isPrime(x):
	if x <= 1:
		return False
	for i in Primes():
		if i * i > x:
			return True
		if x % i == 0:
			return False
known = [2, 3]

def Primes():
	for n in count(0):
		if n < len(known):
			yield known[n]
		elif n == len(known):
			x = known[-1] + 2
			while not isPrime(x):
				x += 2
			known.append(x)
			yield x
		else:
			raise IndexError('Primes() got ahead of itself')

def D(N, squareFlag=False):
	exponents = []
	for p in Primes():
		if N % p == 0:
			e = 0
			while N % p == 0:
				e += 1
				N //= p
			exponents.append(e)
		if N == 1:
			break
		if p * p > N:
			exponents.append(1)
			break
	if squareFlag:
		exponents = [e // 2 for e in exponents]
	prod = 1
	for e in exponents:
		prod *= e + 1
	return prod

def SD(N):
	return D(N, squareFlag=True)
T = int(input())
for _ in range(T):
	N = int(input())
	if 3 & N:
		print(0)
		continue
	n = N >> 2
	F = Fraction(SD(n) - isSquare(n), D(N) - 1)
	print('%i/%i' % (F.numerator, F.denominator))


import math
from fractions import Fraction

def divisors(n):
	factors = {}
	nn = n
	i = 2
	while i * i <= nn:
		while nn % i == 0:
			if not i in factors:
				factors[i] = 0
			factors[i] += 1
			nn //= i
		i += 1
	if nn > 1:
		factors[nn] = 1
	primes = list(factors.keys())

	def generate(k):
		if k == len(primes):
			yield 1
		else:
			rest = generate(k + 1)
			prime = primes[k]
			for factor in rest:
				prime_to_i = 1
				for _ in range(factors[prime] + 1):
					yield (factor * prime_to_i)
					prime_to_i *= prime
	for factor in generate(0):
		yield factor
t = int(input())
for _ in range(t):
	n = int(input())
	total = 0
	perf = 0
	for i in divisors(n):
		if i == n:
			continue
		total += 1
		if i % 4 == 0:
			if int(math.sqrt(i)) ** 2 == i:
				perf += 1
	print(Fraction(perf, total))


def bitize(x):
	L = []
	while x > 0:
		L.append(x % 2)
		x //= 2
	if not L:
		L = [0]
	return L

def pow_mod(a, b, m):
	b_bits = bitize(b)
	a_powers = [0 for x in b_bits]
	a_powers[0] = a % m
	if b_bits[0]:
		total = a % m
	else:
		total = 1
	for i in range(1, len(b_bits)):
		a_powers[i] = a_powers[i - 1] * a_powers[i - 1] % m
		if b_bits[i]:
			total *= a_powers[i]
			total %= m
	return total

def gcd_matrix(a, b):
	M = [[1, 0, a], [0, 1, b]]
	if a > 0 and b > 0:
		while M[0][2] != 0 and M[1][2] != 0:
			if M[0][2] > M[1][2]:
				multiple = M[0][2] // M[1][2]
				for i in range(0, 3):
					M[0][i] -= multiple * M[1][i]
			elif M[0][2] < M[1][2]:
				multiple = M[1][2] // M[0][2]
				for i in range(0, 3):
					M[1][i] -= multiple * M[0][i]
			elif M[0][2] == M[1][2]:
				return M[0][2]
		if M[0][2] == 0:
			return M[1][2]
		else:
			return M[0][2]
	elif a != 0 and b != 0:
		return gcd_matrix(abs(a), abs(b))
	else:
		return 0

def is_miller_rabin(x, num_tests=3):
	k = x - 1
	e = 0
	while k % 2 == 0:
		e += 1
		k //= 2
	tests = [False for _ in range(0, num_tests)]
	A = [2, 3, 5]
	for j in range(3, num_tests):
		A.append(random.randint(7, x - 1))
	if x < 2047:
		num_tests = 1
	elif x < 1373653:
		num_tests = 2
	elif x < 25326001:
		num_tests = 3
	for i in range(0, num_tests):
		ak = pow_mod(A[i], k, x)
		if ak == 1:
			tests[i] = True
		else:
			for j in range(0, e):
				if ak == x - 1:
					tests[i] = True
				ak = ak * ak % x
	for i in range(0, num_tests):
		if not tests[i]:
			return False
	return True

def factor(n, PL):
	sqrt = int(pow(n, 0.5)) + 1
	factor_list = []
	if not PL:
		PL = prime_list(sqrt)
	for p in PL:
		if n % p == 0:
			elet = [p, 0]
			while not n % p:
				n //= p
				elet[1] += 1
			factor_list.append(elet)
	if n != 1:
		if is_miller_rabin(n):
			factor_list.append([n, 1])
	return factor_list

def is_prime(x, L=[]):
	sqrt = int(pow(x, 0.5)) + 1
	PL = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 16, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199]
	if not L:
		if x < 210:
			if x in PL:
				return True
			else:
				return False
		else:
			for p in PL:
				if x % p == 0:
					return False
			for i in range(1, sqrt // 210 + 1):
				for j in [1, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 121, 127, 131, 137, 139, 143, 149, 151, 157, 163, 167, 169, 173, 179, 181, 187, 191, 193, 197, 199, 209]:
					if x % (210 * i + j) == 0:
						return False
		return True
	elif x != 0 and x != 1:
		j = 0
		while j < len(L) and L[j] <= sqrt:
			if x % L[j] == 0:
				return False
			j += 1
	else:
		return False
	return True

def prime_list(n):
	L = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199]
	for k in range(1, n // 210):
		for j in [1, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 121, 127, 131, 137, 139, 143, 149, 151, 157, 163, 167, 169, 173, 179, 181, 187, 191, 193, 197, 199, 209]:
			if is_prime(210 * k + j, L):
				L.append(210 * k + j)
	k = n // 210
	for j in [1, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 121, 127, 131, 137, 139, 143, 149, 151, 157, 163, 167, 169, 173, 179, 181, 187, 191, 193, 197, 199, 209]:
		if is_prime(210 * k + j, L) and 210 * k + j <= n:
			L.append(210 * k + j)
	return L

def compute_probability_of_even_perfect_square(N, list_of_primes):
	if N % 4 != 0:
		return (0, 1)
	factors_of_N = factor(N, list_of_primes)
	all_evens = True
	even_perfect_squares = 1
	total_divisors = 1
	for f in factors_of_N:
		total_divisors *= 1 + f[1]
		if f[0] == 2:
			even_perfect_squares *= (f[1] - 2) // 2 + 1
		else:
			even_perfect_squares *= f[1] // 2 + 1
		if f[1] % 2:
			all_evens = False
	total_divisors -= 1
	if all_evens:
		even_perfect_squares -= 1
	g = gcd_matrix(even_perfect_squares, total_divisors)
	if g != 0:
		even_perfect_squares //= g
		total_divisors //= g
	return (even_perfect_squares, total_divisors)
PL = prime_list(50000)
(p_one_million, q_one_million) = compute_probability_of_even_perfect_square(1000000, PL)
T = int(input())
for _ in range(0, T):
	N = int(input())
	if N == 1000000:
		print(str(p_one_million) + '/' + str(q_one_million))
	else:
		(p, q) = compute_probability_of_even_perfect_square(N, PL)
		if p != 0:
			print(str(p) + '/' + str(q))
		else:
			print(0)


import sys
from time import time

def get_cache(n):
	cache = dict()
	r = int(pow(n, 0.5))
	for d in range(2, r + 1, 2):
		d2 = d * d
		for i in range(d2 + d2, n, d2):
			if i not in cache:
				cache[i] = 1
			else:
				cache[i] += 1
	return cache

def primes_gen(n):
	cache = [True] * n
	for p in range(2, n):
		if cache[p]:
			yield p
			for i in range(p + p, n, p):
				cache[i] = False

def pfs_gen(n, prms):
	for p in prms:
		if p > n:
			break
		cnt = 0
		while n % p == 0:
			cnt += 1
			n //= p
		if cnt > 0:
			yield (p, cnt)
	if n > 1:
		yield (n, 1)

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def solve(n, cache, prms):
	if n not in cache:
		return 0
	u = cache[n]
	v = 1
	for (f, c) in pfs_gen(n, prms):
		v *= c + 1
	v -= 1
	g = gcd(u, v)
	return (u // g, v // g)
tm = time()
N = pow(10, 6)
cache = get_cache(N + 1)
prms = tuple(primes_gen(N + 1))
t = int(input())
for _ in range(t):
	n = int(input())
	t = solve(n, cache, prms)
	if t == 0:
		print(t)
	else:
		(u, v) = t
		print('%d/%d' % (u, v))
print('time elapsed: %s' % (time() - tm), file=sys.stderr)


from collections import Counter, defaultdict
from itertools import combinations

def find_primes(n):
	primes = []
	i = 2
	while i * i <= n:
		if n % i == 0:
			n /= i
			primes.append(i)
		else:
			i += 1
	if n > 1:
		primes.append(int(n))
	return primes

def find_divisors(primes):
	divs = set()
	divs.add(1)
	attempts = set()
	for i in range(len(primes)):
		for iters in combinations(primes, i):
			if iters in attempts:
				continue
			attempts.add(iters)
			num = 1
			for val in iters:
				num *= val
			divs.add(num)
	return divs

def co_primes(first, second):
	p = 1
	for num in first:
		if num in second:
			second.pop(second.index(num))
		else:
			p *= num
	q = 1
	for sec in second:
		q *= sec
	return '{}/{}'.format(p, q)
previous = defaultdict(str)
for _ in range(int(input())):
	M = int(input())
	if M in previous:
		pass
	else:
		primes = find_primes(M)
		p_count = Counter(primes)
		divs = find_divisors(primes)
		N = len(divs)
		count = 0
		j = 2
		while j * j <= max(divs):
			if j * j in divs:
				count += 1
			j += 2
		if count == 0:
			previous[M] = '0'
		else:
			first = find_primes(count)
			second = find_primes(N)
			out = co_primes(first, second)
			previous[M] = out
	print(previous[M])


from functools import reduce
from fractions import Fraction
import math
divisors = [1] * (10 ** 6 + 1)
divisors[0] = 0
even_squares = []
for i in range(2, 10 ** 6 + 1):
	if i % 2 == 0 and int(i ** 0.5) ** 2 == i:
		even_squares.append(i)
	for j in range(2 * i, 10 ** 6 + 1, i):
		divisors[j] += 1
num_even_squares = [0] * (10 ** 6 + 1)
for i in even_squares:
	for j in range(2 * i, 10 ** 6 + 1, i):
		num_even_squares[j] += 1
for i in range(int(input())):
	n = int(input())
	if num_even_squares[n] == 0:
		print(0)
	else:
		prob = Fraction(num_even_squares[n], divisors[n])
		print(prob.numerator, prob.denominator, sep='/')


import math

def gcd(a, b):
	if a % b == 0:
		return b
	else:
		return gcd(b, a % b)

def divisors(n):
	ns = math.ceil(math.sqrt(n))
	num = 1
	do = 0
	if ns * ns == n:
		num += 1
		if ns == int(math.sqrt(ns)) ** 2:
			do += 1
	for i in range(2, ns):
		if n % i == 0:
			num += 2
			if i % 2 == 0 and i == int(math.sqrt(i)) ** 2:
				do += 1
			j = n // i
			if j % 2 == 0 and j == int(math.sqrt(j)) ** 2:
				do += 1
	if do == 0:
		return (0, 0)
	t = gcd(num, do)
	return (do // t, num // t)
for _ in range(int(input())):
	n = int(input())
	(a, b) = divisors(n)
	if a == 0:
		print(0)
	else:
		print('{}/{}'.format(a, b))


from functools import reduce
import math as m
from fractions import Fraction

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(pow(n, 0.5) + 1)) if n % i == 0)))

def gcd(a, b):
	return gcd(b, a % b) if b else a
T = int(input())
for t in range(T):
	num = int(input())
	fs = sorted(list(factors(num)))
	fs.pop()
	eps = 0
	for i in fs:
		if i % 2 == 0 and m.sqrt(i) == int(m.sqrt(i)):
			eps += 1
	div = gcd(eps, len(fs))
	top = int(eps / div)
	bot = int(len(fs) / div)
	if eps == 0:
		print(0)
	else:
		print('/'.join((str(top), str(bot))))


def findfactors(N):
	d = []
	for j in range(1, int(sqrt(N) + 1)):
		if N % j == 0:
			d.append(j)
			if j != 1 and N / j != j:
				d.append(N / j)
	return d
from math import sqrt
T = int(input())
for i in range(T):
	N = int(input())
	d = findfactors(N)
	even = []
	for k in d:
		if k % 2 == 0 and sqrt(k).is_integer():
			even.append(k)
	p = len(even)
	q = len(d)
	pf = set(findfactors(p) + [p])
	qf = set(findfactors(q) + [q])
	cf = list(pf.intersection(qf))
	if p == 0:
		print(0)
	else:
		print(str(int(p / max(cf))) + '/' + str(int(q / max(cf))))


import math
from fractions import Fraction
N = int(input().strip())
numbers = {}
for i in range(N):
	n = int(input().strip())
	if n % 4 != 0:
		print(0)
	elif n in numbers:
		print(Fraction(numbers[n][0], numbers[n][1]))
	else:
		proper = set()
		even = set()
		proper.add(1)
		for i in range(2, int(math.sqrt(n)) + 2):
			if int(n / i) * i == n:
				proper.add(i)
				proper.add(n / i)
				if math.sqrt(i) % 2 == 0:
					even.add(i)
				if math.sqrt(n / i) % 2 == 0:
					even.add(n / i)
		numbers[n] = (len(even), len(proper))
		print(Fraction(len(even), len(proper)))


from math import sqrt
from fractions import Fraction
arr = [x * x for x in range(2, 1000, 2)]

def totalD(a):
	count = 1
	for x in range(2, int(sqrt(a)) + 1):
		if a % x == 0:
			if a / x == x:
				count += 1
			else:
				count += 2
	return count

def favD(a):
	count = 0
	for x in arr:
		if x < a and a % x == 0:
			count = count + 1
	return count
n = int(input())
for x in range(n):
	a = int(input())
	print(Fraction(favD(a), totalD(a)))


from fractions import Fraction
from math import sqrt
sieve = [True for el in range(10 ** 6 + 1)]
sieve[1] = False
i = 2
while i < len(sieve):
	if sieve[i]:
		j = i
		while i * j < len(sieve):
			sieve[i * j] = False
			j += 1
	i += 1
primes_up_to_a_million = [i for i in range(2, len(sieve)) if sieve[i]]
all_primes = set(primes_up_to_a_million)
memo_pd = {}
memo_pf = {}

def count_proper_divisors(n):
	if n in memo_pd:
		return memo_pd[n]
	div_dict = {}
	old_n = n
	for p in primes_up_to_a_million:
		if p > old_n // 2:
			break
		elif n in all_primes:
			if n not in div_dict:
				div_dict[n] = 1
			else:
				div_dict[n] += 1
			break
		while n % p == 0:
			if p not in div_dict:
				div_dict[p] = 1
			else:
				div_dict[p] += 1
			n = n // p
	res = 1
	for exp in div_dict.values():
		res = res * (exp + 1)
	memo_pd[old_n] = res - 1
	return res - 1

def count_perfect_square_divisors(n):
	if n in memo_pf:
		return memo_pf[n]
	res = 0
	i = 2
	while i * i <= n // 2:
		if n % (i * i) == 0:
			res += 1
		i += 2
	memo_pf[n] = res
	return res
n_cases = int(input())
for i in range(n_cases):
	numerator = 0
	denominator = 0
	inp = int(input())
	if inp < 8:
		print(0)
		continue
	numerator = count_perfect_square_divisors(inp)
	denominator = count_proper_divisors(inp)
	if denominator == 0:
		print(0)
	else:
		print(Fraction(numerator, denominator))


from math import *
x = int(input())
resultstore = [-1] * 10000000
for i in range(0, x):
	N = int(input())
	if resultstore[N] == -1:
		propersquares = []
		alls = [1]
		for i in range(2, int(N ** 0.5) + 1):
			if i == N:
				continue
			elif N % i == 0:
				if i % 2 == 0 and round(i ** 0.5) ** 2 == i:
					propersquares.append(i)
					alls.append(i)
				else:
					alls.append(i)
				y = N // i
				if y != i and y != N:
					if y % 2 == 0 and round(y ** 0.5) ** 2 == y:
						propersquares.append(y)
						alls.append(y)
					else:
						alls.append(y)
		if len(propersquares) == 0:
			print(0)
		else:
			print(str(len(propersquares) // gcd(len(propersquares), len(alls))) + '/' + str(len(alls) // gcd(len(propersquares), len(alls))))
			resultstore[N] = str(len(propersquares) // gcd(len(propersquares), len(alls))) + '/' + str(len(alls) // gcd(len(propersquares), len(alls)))
	else:
		print(resultstore[N])


import fractions

def primes(n):
	primfac = {}
	d = 2
	while d * d <= n:
		while n % d == 0:
			if d in primfac:
				primfac[d] += 1
			else:
				primfac[d] = 1
			n /= d
		d += 1
	if n > 1:
		if n in primfac:
			primfac[n] += 1
		else:
			primfac[n] = 1
	return primfac

def numf(n):
	prod = 1
	dictx = primes(n)
	for i in dictx:
		prod *= dictx[i] + 1
	return prod - 1

def numeps(n):
	if n % 4 != 0:
		return 0
	else:
		n = int(n / 4)
		prod = 1
		dictx = primes(n)
		for i in dictx:
			prod *= int(dictx[i] / 2 + 1)
		if n ** 0.5 % 1 == 0:
			return prod - 1
		else:
			return prod

def simplify(num, denom):
	gcd = fractions.gcd(num, denom)
	num = int(num / gcd)
	denom = int(denom / gcd)
	return str(num) + '/' + str(denom)

def compute(n):
	if numeps(n) == 0:
		return 0
	return simplify(numeps(n), numf(n))
ints = int(input())
for i in range(ints):
	print(compute(int(input())))