Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- code for https://math.stackexchange.com/questions/2805326/is-ab-a-unit-if-a-b-a-b-are-zero-divisors
- function ZD(a,n)
- for b=1,n-1 do
- if (a*b)%n==0 then return true end
- end
- return false
- end
- function test(n)
- for a=1,n-1 do
- for b=a,n-1 do
- if ZD(a,n) and ZD(b,n) and ZD(a-b,n) and not ZD(a+b,n) then
- print(n,a,b)
- --return
- end
- end
- end
- end
- for n=2,1000 do
- --test(n)
- end
- test(42)
Advertisement
Add Comment
Please, Sign In to add comment