payload: {"action":"created","issue":{"url":"https://api.github.com/repos/sympy/sympy/issues/17907","repository_url":"https://api.github.com/repos/sympy/sympy","labels_url":"https://api.github.com/repos/sympy/sympy/issues/17907/labels{/name}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/17907/comments","events_url":"https://api.github.com/repos/sympy/sympy/issues/17907/events","html_url":"https://github.com/sympy/sympy/issues/17907","id":522840598,"node_id":"MDU6SXNzdWU1MjI4NDA1OTg=","number":17907,"title":"Inconsistent execution times for Legendre/Jacobi simbols","user":{"login":"St333p","id":33753050,"node_id":"MDQ6VXNlcjMzNzUzMDUw","avatar_url":"https://avatars3.githubusercontent.com/u/33753050?v=4","gravatar_id":"","url":"https://api.github.com/users/St333p","html_url":"https://github.com/St333p","followers_url":"https://api.github.com/users/St333p/followers","following_url":"https://api.github.com/users/St333p/following{/other_user}","gists_url":"https://api.github.com/users/St333p/gists{/gist_id}","starred_url":"https://api.github.com/users/St333p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/St333p/subscriptions","organizations_url":"https://api.github.com/users/St333p/orgs","repos_url":"https://api.github.com/users/St333p/repos","events_url":"https://api.github.com/users/St333p/events{/privacy}","received_events_url":"https://api.github.com/users/St333p/received_events","type":"User","site_admin":false},"labels":[{"id":84627349,"node_id":"MDU6TGFiZWw4NDYyNzM0OQ==","url":"https://api.github.com/repos/sympy/sympy/labels/ntheory","name":"ntheory","color":"0000FF","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2019-11-14T12:57:54Z","updated_at":"2019-11-17T20:16:31Z","closed_at":null,"author_association":"NONE","body":"As far as I know the Legendre symbol is a particular case of the Jacobi symbol. In other words to calculate the Legendre symbol it's enough to check the primality of the second parameter and calculate the Jacobi symbol.\r\nOn sympy 1.4 (latest on pip3) I get this result:\r\n```\r\n>>> timeit(\"sympy.legendre_symbol(1012,1009)\",setup, number=100000)\r\n0.8614236980029091\r\n>>> timeit(\"sympy.jacobi_symbol(1012,1009)\",setup, number=100000)\r\n0.30404673799785087\r\n>>> timeit(\"sympy.isprime(1009)\",setup, number=100000)\r\n0.18222121800135938\r\n```\r\nClearly the time required to calculate a Legendre symbol is far bigger than the primality check plus the Jacobi calculation. I this a bug or a desired behavior?"},"comment":{"url":"https://api.github.com/repos/sympy/sympy/issues/comments/554781853","html_url":"https://github.com/sympy/sympy/issues/17907#issuecomment-554781853","issue_url":"https://api.github.com/repos/sympy/sympy/issues/17907","id":554781853,"node_id":"MDEyOklzc3VlQ29tbWVudDU1NDc4MTg1Mw==","user":{"login":"giorgosgiapis","id":13292707,"node_id":"MDQ6VXNlcjEzMjkyNzA3","avatar_url":"https://avatars3.githubusercontent.com/u/13292707?v=4","gravatar_id":"","url":"https://api.github.com/users/giorgosgiapis","html_url":"https://github.com/giorgosgiapis","followers_url":"https://api.github.com/users/giorgosgiapis/followers","following_url":"https://api.github.com/users/giorgosgiapis/following{/other_user}","gists_url":"https://api.github.com/users/giorgosgiapis/gists{/gist_id}","starred_url":"https://api.github.com/users/giorgosgiapis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giorgosgiapis/subscriptions","organizations_url":"https://api.github.com/users/giorgosgiapis/orgs","repos_url":"https://api.github.com/users/giorgosgiapis/repos","events_url":"https://api.github.com/users/giorgosgiapis/events{/privacy}","received_events_url":"https://api.github.com/users/giorgosgiapis/received_events","type":"User","site_admin":false},"created_at":"2019-11-17T20:16:31Z","updated_at":"2019-11-17T20:16:31Z","author_association":"CONTRIBUTOR","body":"As a reference, without the above change, I am getting\r\n```py\r\nIn [2]: timeit.timeit(\"sympy.legendre_symbol(1012,1009)\",setup=\"import sympy\", number=100000)\r\nOut[2]: 1.04446601868\r\n```\r\nwhile after modifying the code\r\n```py\r\nIn [2]: timeit.timeit(\"sympy.legendre_symbol(1012,1009)\",setup=\"import sympy\", number=100000)\r\nOut[2]: 0.538429021835\r\n```\r\n"}}
other: {"actor":{"display_login":"giorgosgiapis"}}