ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 25 Nov 2018 20:58:03 -0600Finding coprime integers near a lattice pointhttp://ask.sagemath.org/question/44435/finding-coprime-integers-near-a-lattice-point/ I have a list $L$ of ordered pairs $(n,m)$ where $n$ and $m$ are integers. I would like to know which elements $(n,m)$ in $L$ satisfy the property that $\gcd(n+i,m+j) \neq 1$ for $i =-1,0,1$ and $j =-1,0,1.$ For example the point $(55,21)$ has this property since $[(55+i,21+j) ] = [(54,20),(54,21),(54,22),(55,20),(55,21),(55,22),(56,20),(56,21),(56,22)].$ I have tried the following :
`for (n,m) in L:
for i in range(-1,2):
for j in range(-1,2):
if gcd(n+i,m+j)!=1:
print(n,m)`
which returns any point with $gcd =1$ which is not what I want.
Thanks very much for your help!
cihanSun, 25 Nov 2018 20:58:03 -0600http://ask.sagemath.org/question/44435/