darshak-and-its-co-primes

Darshak (Dark) was playing with numbers and started learning various concepts of prime numbers, composite numbers...

One day he got bored solving problems of easy level so he started searching new concepts and end up reading about relative primes...

So he want you to help me design a program which takes two numbers 'p' & 'q' and decides whether they are mutually primes or not.

Mutually primes means nothing but "Co-Primes".

Input:

First line contains 't' number of test cases, each line contains two numbers 'p' and 'q'.

Output:

If they are mutually prime then print "Is a Co-Prime"  and if not found then print "Not a Co-Prime".

Constraints:

1 ≤ t ≤ 5*10^3

1 ≤ p,q ≤ 10^18

Author : Darshak Mehta

SAMPLE INPUT
2
5 32
6 12

SAMPLE OUTPUT
Is a Co-Prime
Not a Co-Prime

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
def gcd(x,y):
	while y:
		x,y=y,x%y
	return x	
for _ in range(eval(input())):
	a,b=list(map(int,input().split()))
	if gcd(a,b)==1:
		print('Is a Co-Prime')
	else:
		print('Not a Co-Prime')


import math
import sys
def gcd(a,b):
	if (b==0):
		return a
	else:
		return int(gcd(b,a-b*math.floor(a/b)))

for _ in range(int(eval(input()))):
	p,q=list(map(int,sys.stdin.readline().split()))
	if gcd(p,q)==1:
		print("Is a Co-Prime")
	else:
		print("Not a Co-Prime")


import string

t=int(input())
mylist=[]


def cop (pair):

	while pair[1]!=0 :
		temp=pair[1]
		pair[1]=pair[0]%pair[1]
		pair[0]=temp
		res=pair[0]
	if res==1:
		print('Is a Co-Prime')
	else :
		print('Not a Co-Prime')
		

for i in range(t):
	
	no=input()
	mylist=(no.split())

	for i in range(len(mylist)):
	mylist[i]=string.atoi(mylist[i])

	res=cop(mylist)
	



	


import fractions
t=int(input())
while t:
	t-=1
	p,q = list(map(int,input().split()))
	if fractions.gcd(p,q) == 1:
		print("Is a Co-Prime")
	else:
		print("Not a Co-Prime")


from fractions import gcd
t=eval(input())
while(t):
	ip=input().split()
	p=int(ip[0])
	q=int(ip[1])
	if (gcd(p,q)==1) :
		print("Is a Co-Prime")
	else:
		print("Not a Co-Prime")
	t-=1


t=eval(input())
from fractions import gcd

while t>0:
	a,b=list(map(int,input().split()))
	c=gcd(a,b)
	if c==1:
		print('Is a Co-Prime')
	else:
		print('Not a Co-Prime')
	t-=1 


from fractions import gcd
	
t=int(eval(input()))
for i in range(t):
	a,b=input().split()
	a,b=int(a),int(b)
	if gcd(a,b)==1:
		print("Is a Co-Prime")
	else:
		print("Not a Co-Prime")


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

def main():
	for _ in range(eval(input())):
		n, m = list(map(int, input().split()))
		if gcd(n, m) == 1:
			print("Is a Co-Prime")
		else:
			print("Not a Co-Prime")
	return 0
	
if __name__ == "__main__":
	main()


from fractions import gcd
t=int(input())
for i in range(t):
	a,b=list(map(int,input().split()))
	if gcd(a,b)==1:
		print("Is a Co-Prime")
	else:
		print("Not a Co-Prime")


from fractions import gcd
import sys
t=int(eval(input()))
for i in range(0,t):
	a,b = list(map(int,sys.stdin.readline().split()))
	c=gcd(a,b)
	if c==1:
		print("Is a Co-Prime")
	else:
		print("Not a Co-Prime")


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

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
def gcd(a,b):
	if a>b:
		a,b=b,a
	while b%a:
		tmp=b%a
		b=a
		a=tmp
	return a
t=int(input())
while t:
	m=list(map(int,input().split()))
	if gcd(m[0],m[1])==1:
		print('Is a Co-Prime')
	else:
		print('Not a Co-Prime')
	t-=1



#!/usr/bin/python 
from fractions import gcd
for i in range(eval(input())):
	a,b=list(map(int,input().split()))
	if gcd(a,b)==1: 
		print("Is a Co-Prime")
	else:
		print("Not a Co-Prime")


from fractions import gcd

for i in range(int(input())):
	s = [int(i) for i in input().split()]
	if gcd(s[0], s[1]) == 1:
		print("Is a Co-Prime")
	else:
		print("Not a Co-Prime")