Skip to content

Instantly share code, notes, and snippets.

@naxmefy
Last active April 30, 2021 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naxmefy/6eba874b5203ec875c27fe7a81a33f8d to your computer and use it in GitHub Desktop.
Save naxmefy/6eba874b5203ec875c27fe7a81a33f8d to your computer and use it in GitHub Desktop.
a and b both dividable by same integer or coprime (gcd)
eval"p %d.gcd(%d)<2"%[*$<]
f=()=>parseInt(readline())
a=f()
b=f()
p=0
for(i=2;i<b;i++)if(!(a%i)&&!(b%i))p=1
print(!p)
r=readline
g=(a,b)=>b?g(b,a%b):a
print(g(r(),r())==1)
#!perl -p
$'%$_||$_[$_]++for 2*//..$_}{$_="@_"=~2?false:true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment