Python 2/3, (削除) 220 (削除ここまで) 202(削除) 202 (削除ここまで)(削除) 195 (削除ここまで) 183 bytes
g=lambda a,b:a and g(b%a,a)or b
def f(nb;n,dd=input():
m=[];c=[];m=c=()
while n+d>2:
t=n*d;f=p=2
while t>p:
if if t%p:p+=1;f*=p
else else:t/=p
if n%p:c+=[p];n*=fc+=p,;n*=f
else:m+=[p];d*=fm+=p,;d*=f
t=g(n,d);n/=t;d/=t
print return[mm,c]c
Try it online! Try it online! Edit: Saved 18(削除) 18 (削除ここまで) 25 bytes thanks to @Mr.Xcoder. Saved 12 bytes thanks to @JonathanFrech.
Python 2/3, (削除) 220 (削除ここまで) 202 bytes
g=lambda a,b:a and g(b%a,a)or b
def f(n,d):
m=[];c=[]
while n+d>2:
t=n*d;f=p=2
while t>p:
if t%p:p+=1;f*=p
else:t/=p
if n%p:c+=[p];n*=f
else:m+=[p];d*=f
t=g(n,d);n/=t;d/=t
return[m,c]
Try it online! Edit: Saved 18 bytes thanks to @Mr.Xcoder.
Python 2, (削除) 220 (削除ここまで) (削除) 202 (削除ここまで)(削除) 195 (削除ここまで) 183 bytes
g=lambda a,b:a and g(b%a,a)or b;n,d=input();m=c=()
while n+d>2:
t=n*d;f=p=2
while t>p:
if t%p:p+=1;f*=p
else:t/=p
if n%p:c+=p,;n*=f
else:m+=p,;d*=f
t=g(n,d);n/=t;d/=t
print m,c
Try it online! Edit: Saved (削除) 18 (削除ここまで) 25 bytes thanks to @Mr.Xcoder. Saved 12 bytes thanks to @JonathanFrech.
Python 2/3, 220(削除) 220 (削除ここまで) 202 bytes
g=lambda a,b:a and g(b%a,a)or b
def f(n,d):
m=[];c=[]
while n+d>2:
t=n*d;f=p=2
while t>p:
if t%p:p+=1;f*=p
else:t/=p
if n%p:c+=[p];n*=f
else:m+=[p];d*=f
t=g(n,d);n/=t;d/=t
return[m,c]
g=lambda a,b:a and g(b%a,a)or b
def f(n,d):
m=[];c=[]
while n+d>2:
t=n*d;f=p=2
while t>p:
if t%p:
p+=1;f*=p
else:
t/=p
if n%p:
c+=[p];n*=f
else:
m+=[p];d*=f
t=g(n,d);n/=t;d/=t
return[m,c]
Try it online! Edit: Saved 18 bytes thanks to @Mr.Xcoder.
Python 2, 220 bytes
g=lambda a,b:a and g(b%a,a)or b
def f(n,d):
m=[];c=[]
while n+d>2:
t=n*d;f=p=2
while t>p:
if t%p:
p+=1;f*=p
else:
t/=p
if n%p:
c+=[p];n*=f
else:
m+=[p];d*=f
t=g(n,d);n/=t;d/=t
return[m,c]
Python 2/3, (削除) 220 (削除ここまで) 202 bytes
g=lambda a,b:a and g(b%a,a)or b
def f(n,d):
m=[];c=[]
while n+d>2:
t=n*d;f=p=2
while t>p:
if t%p:p+=1;f*=p
else:t/=p
if n%p:c+=[p];n*=f
else:m+=[p];d*=f
t=g(n,d);n/=t;d/=t
return[m,c]
Try it online! Edit: Saved 18 bytes thanks to @Mr.Xcoder.