Jacobi symbol: Difference between revisions

Content added Content deleted
Line 780: Line 780:
end
end
a, n = n, a
a, n = n, a
res = -res if (a % 4 == n % 4) == 3
res = -res if [a % 4, n % 4] == [3, 3]
end
end
n == 1 ? res : 0
n == 1 ? res : 0