Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/Jacobi-symbol/J/jacobi-symbol.j
Normal file
14
Task/Jacobi-symbol/J/jacobi-symbol.j
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
NB. functionally equivalent translation of the Lua program found
|
||||
NB. at https://en.wikipedia.org/wiki/Jacobi_symbol
|
||||
jacobi=: {{
|
||||
assert. (0<x) * 1=2|x
|
||||
y=. x|y
|
||||
t=. 1
|
||||
while. y do.
|
||||
e=. (|.#:y) i.1
|
||||
y=. <.y%2^e
|
||||
t=. t*_1^(*/3 = 4|x,y)+(2|e)*(8|x) e.3 5
|
||||
'x y'=. y, y|x
|
||||
end.
|
||||
t*x=1
|
||||
}}"0
|
||||
Loading…
Add table
Add a link
Reference in a new issue