Jacques Gélinas on Tue, 16 Feb 2021 23:37:26 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: jean-pierre Cherdieu <jpcherdi@gmail.com>, "pari-users@pari.math.u-bordeaux.fr" <pari-users@pari.math.u-bordeaux.fr>
- Subject: Re: jacobi symbol
- From: Jacques Gélinas <jacquesg00@hotmail.com>
- Date: Tue, 16 Feb 2021 22:37:21 +0000
- Accept-language: fr-CA, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xP2P4Axoz0FpxeaPQ1IrY66yw8uIiBybQQPpfagD0yE=; b=DQHVZ8h8a6LuoY0C+ul7QkhYNl1dWrTTaULz6A63WlzzFXpA8FsbEW6gpC0vMJFqq95/2Bp9203O9USN6vKTkqXETBDm242SQ9+CL7YBshaeI3NSrca3scHNAALicL6bX7L9yEA0iG5SgeeKE3zu8AjcLaj4FMRf4AvCtnv37Im4pgN1CeCsb7RKaTdJKKyY9wMEXQXsUctSW1VagBoQHNCrpN9zBOwSXPRVNcKIBUu5Og0nAkL8sgpCL6mJzHDWxSI3a59pxPVLmQbJ9+b1+HLknKhguAllKhDWhvCTRKMaCUPuzOWQtPH89t3Au6BSRb+D561zKcxIJxc7KFyVMg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UF9avOl3L2aRtiOd3KSkEkD7U+pMg5xiFbE6sd9LNl5VAxBB3MGBMlngaKsEFOlDzSrgN0UioQRyDqYvBoDgW5p1o0ATcy2ZH6b0xjZIiSzpCTeix3cidoHuq00Vpnucm19ZdnJ+RjHxaBpdeWNHxnhfBHk2ZjBc4VB727MxV03mBu+5dQBfuFNkjDAGrQDH/zbJEqWTbgDI3MiJqpz5w5mBV5oGsczDlsQCp5kjpIRWvHTsLcl3rMGG9DEvy9D+QFhTcEh9/IMiRIuX17ADXzkX3xhJvzHlwxWP51yuJTI+6oPBhcgzvjMGibkgmgOGgPsyRt3dLj4oNC4ZdEQkJg==
- Delivery-date: Tue, 16 Feb 2021 23:37:26 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xP2P4Axoz0FpxeaPQ1IrY66yw8uIiBybQQPpfagD0yE=; b=TvuzWNdqtjYSHFCujetT+evbsQLZUheh9dmoJELPcM36PAy5kI7JUWG2bGklTeisyFFKUNpg8Tg6JcWAWbk7vlWzsped5D+rlYm6vkfkO+L1bz8J2TLKCbqI2DZbqqjT9mUjE4SzzpCXC0ZQijXUJ4UG2ysHe9btdDjyuFHdWSyK8XJFGl/2UDlfNZvODP1jH7LrQAh1CggbcLx0LEIPPw7J3BCJoGKR7hS7b5OhOtKEX2+2pu6hiqIjLEKJoHFo8ey9Cs5WbEwU2ByoAQeP2EnXlS/lKhhwCEKLeJkGmeHsnSiWsArzWCWPKVgmKmGe9FwctnmMUshk6jmqo2fZng==
- In-reply-to: <CA+1Xo7xPWMKnGMsuQWZR8J95Hxd4MmGi5ZY8o1uTnoE3pMpH9A@mail.gmail.com>
- References: <CA+1Xo7xPWMKnGMsuQWZR8J95Hxd4MmGi5ZY8o1uTnoE3pMpH9A@mail.gmail.com>
- Thread-index: AQHXBKahRERw8aMWMUWZXiwObqupdapbXcuI
- Thread-topic: jacobi symbol
/* Jacobi symbol, defined as the product of the Legendre symbols for prime factors of n
following a Lua program from http://en.wikipedia.org/wiki/Jacobi_symbol
(with arguments permuted!! as downloaded on 2021-02-16)
*/
{addhelp(jacobisb, "jacobisb(k,n): jacobi symbol (k/n) =
product L(k/p)^np of Legendre symbols for prime factors p^np of n");
jacobisb(k,n) = { my(r,t=1);
if( !(k>0 && k%2), error());
n = n%k;
while(n, while( !(n%2), n/=2; r=k%8; if(r==3||r==5, t=-t));
r=n;n=k;k=r; if( n%4==3 && k%4==3, t=-t); n=n%k );
return( if(k==1,t,0) );
}
/* Verify table from Wikipedia */
PASS(e) = if(!e,error() );
PASS( apply( k->jacobisb(1,k),[1..5]) == [1, 1, 1, 1, 1] );
PASS( apply( k->jacobisb(3,k),[1..5]) == [1,-1, 0, 1,-1] );
PASS( apply( k->jacobisb(5,k),[1..5]) == [1,-1,-1, 1, 0] );
PASS( apply( k->jacobisb(7,k),[1..5]) == [1, 1,-1, 1,-1] );
PASS( apply( k->jacobisb(9,k),[1..5]) == [1, 1, 0, 1, 1] );
PASS( apply( k->jacobisb(59,k),[1..16]) == [1,-1,1,1,1,-1,1,-1,1,-1,-1,1,-1,-1,1,1] );
Jacques Gélinas
De : jean-pierre Cherdieu <jpcherdi@gmail.com>
Envoyé : 16 février 2021 15:59
À : pari-users@pari.math.u-bordeaux.fr <pari-users@pari.math.u-bordeaux.fr>
Objet : jacobi symbol
hi every body,
does someone know if there is a command to compute the jacobi symbol.
sincerely,
--
Jean-Pierre Cherdieu