PRIME FACES

def Find_Prime_Face(N,S,st):
min_base=st.find(max(N))+1
value=int(N,min_base)
Splus=st.find(S)+1
while True:
if isPrime(value)==True and S in toBase(value,Splus):
print(toBase(value,Splus))
break
value+=1
def toBase(value,Splus):
base_num = “”
while value>0:
dig = int(value%Splus)
if dig<10:
base_num += str(dig)
else:
base_num += chr(ord(‘A’)+dig-10)
value //=Splus
base_num = base_num[::-1]
return base_num
def isPrime(n):
if(n<=1):
return False
if(n<=3):
return True
if (n % 2 == 0 or n % 3 == 0):
return False
i = 5
while (i * i <= n):
if (n % i == 0 or n % (i + 2) == 0):
return False
i = i + 6
return True
t=int(input())
st=‘0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ’
while(t!=0):
N,S=input().split()
if(len(N)<=5):
Find_Prime_Face(N,S,st)
t-=1

How do you expect the forum to help you without even stating the problem?
Also, please post the question link and format your code.