Sh3ll
OdayForums


Server : Apache
System : Linux profile 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64
User : apache ( 48)
PHP Version : 8.0.28
Disable Function : NONE
Directory :  /var/www/html/venkat/check1-june-2016/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/html/venkat/check1-june-2016/gcd.py
def gcd(a,b):
	while a:
		a, b = b%a, a
	return a 

def modinv(a,m):
	gcd , x, y = egcd(a,m)
	if gcd != 1:
		return 0  # modular inverse does not exist
	else:
		return x % m

def egcd(a,b):
	x,y, u,v = 0,1, 1,0
	while a != 0:
		q, r = b//a, b%a
		m, n = x-u*q, y-v*q
		b,a, x,y, u,v = a,r, u,v, m,n
	gcd = b
	return gcd, x, y
kk = input("f: ")
pp = input("p: ")
print modinv(kk,pp)

ZeroDay Forums Mini