Share to: share facebook share twitter share wa share telegram print page

Jacobi symbol

Carl Gustav Jacob Jacobi who introduced the symbol.
k
n
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 1
3 0 1 −1
5 0 1 −1 −1 1
7 0 1 1 −1 1 −1 −1
9 0 1 1 0 1 1 0 1 1
11 0 1 −1 1 1 1 −1 −1 −1 1 −1
13 0 1 −1 1 1 −1 −1 −1 −1 1 1 −1 1
15 0 1 1 0 1 0 0 −1 1 0 0 −1 0 −1 −1
17 0 1 1 −1 1 −1 −1 −1 1 1 −1 −1 −1 1 −1 1 1

Jacobi symbol (k/n) for various k (along top) and n (along left side). Only 0 ≤ k < n are shown, since due to rule (2) below any other k can be reduced modulo n. Quadratic residues are highlighted in yellow — note that no entry with a Jacobi symbol of −1 is a quadratic residue, and if k is a quadratic residue modulo a coprime n, then (k/n) = 1, but not all entries with a Jacobi symbol of 1 (see the n = 9 and n = 15 rows) are quadratic residues. Notice also that when either n or k is a square, all values are nonnegative.

The Jacobi symbol is a generalization of the Legendre symbol. Introduced by Jacobi in 1837,[1] it is of theoretical interest in modular arithmetic and other branches of number theory, but its main use is in computational number theory, especially primality testing and integer factorization; these in turn are important in cryptography.

Definition

For any integer a and any positive odd integer n, the Jacobi symbol (a/n) is defined as the product of the Legendre symbols corresponding to the prime factors of n:

where

is the prime factorization of n.

The Legendre symbol (a/p) is defined for all integers a and all odd primes p by

Following the normal convention for the empty product, (a/1) = 1.

When the lower argument is an odd prime, the Jacobi symbol is equal to the Legendre symbol.

Table of values

The following is a table of values of Jacobi symbol (k/n) with n ≤ 59, k ≤ 30, n odd.

k
n
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
3 1 −1 0 1 −1 0 1 −1 0 1 −1 0 1 −1 0 1 −1 0 1 −1 0 1 −1 0 1 −1 0 1 −1 0
5 1 −1 −1 1 0 1 −1 −1 1 0 1 −1 −1 1 0 1 −1 −1 1 0 1 −1 −1 1 0 1 −1 −1 1 0
7 1 1 −1 1 −1 −1 0 1 1 −1 1 −1 −1 0 1 1 −1 1 −1 −1 0 1 1 −1 1 −1 −1 0 1 1
9 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0
11 1 −1 1 1 1 −1 −1 −1 1 −1 0 1 −1 1 1 1 −1 −1 −1 1 −1 0 1 −1 1 1 1 −1 −1 −1
13 1 −1 1 1 −1 −1 −1 −1 1 1 −1 1 0 1 −1 1 1 −1 −1 −1 −1 1 1 −1 1 0 1 −1 1 1
15 1 1 0 1 0 0 −1 1 0 0 −1 0 −1 −1 0 1 1 0 1 0 0 −1 1 0 0 −1 0 −1 −1 0
17 1 1 −1 1 −1 −1 −1 1 1 −1 −1 −1 1 −1 1 1 0 1 1 −1 1 −1 −1 −1 1 1 −1 −1 −1 1
19 1 −1 −1 1 1 1 1 −1 1 −1 1 −1 −1 −1 −1 1 1 −1 0 1 −1 −1 1 1 1 1 −1 1 −1 1
21 1 −1 0 1 1 0 0 −1 0 −1 −1 0 −1 0 0 1 1 0 −1 1 0 1 −1 0 1 1 0 0 −1 0
23 1 1 1 1 −1 1 −1 1 1 −1 −1 1 1 −1 −1 1 −1 1 −1 −1 −1 −1 0 1 1 1 1 −1 1 −1
25 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0
27 1 −1 0 1 −1 0 1 −1 0 1 −1 0 1 −1 0 1 −1 0 1 −1 0 1 −1 0 1 −1 0 1 −1 0
29 1 −1 −1 1 1 1 1 −1 1 −1 −1 −1 1 −1 −1 1 −1 −1 −1 1 −1 1 1 1 1 −1 −1 1 0 1
31 1 1 −1 1 1 −1 1 1 1 1 −1 −1 −1 1 −1 1 −1 1 1 1 −1 −1 −1 −1 1 −1 −1 1 −1 −1
33 1 1 0 1 −1 0 −1 1 0 −1 0 0 −1 −1 0 1 1 0 −1 −1 0 0 −1 0 1 −1 0 −1 1 0
35 1 −1 1 1 0 −1 0 −1 1 0 1 1 1 0 0 1 1 −1 −1 0 0 −1 −1 −1 0 −1 1 0 1 0
37 1 −1 1 1 −1 −1 1 −1 1 1 1 1 −1 −1 −1 1 −1 −1 −1 −1 1 −1 −1 −1 1 1 1 1 −1 1
39 1 1 0 1 1 0 −1 1 0 1 1 0 0 −1 0 1 −1 0 −1 1 0 1 −1 0 1 0 0 −1 −1 0
41 1 1 −1 1 1 −1 −1 1 1 1 −1 −1 −1 −1 −1 1 −1 1 −1 1 1 −1 1 −1 1 −1 −1 −1 −1 −1
43 1 −1 −1 1 −1 1 −1 −1 1 1 1 −1 1 1 1 1 1 −1 −1 −1 1 −1 1 1 1 −1 −1 −1 −1 −1
45 1 −1 0 1 0 0 −1 −1 0 0 1 0 −1 1 0 1 −1 0 1 0 0 −1 −1 0 0 1 0 −1 1 0
47 1 1 1 1 −1 1 1 1 1 −1 −1 1 −1 1 −1 1 1 1 −1 −1 1 −1 −1 1 1 −1 1 1 −1 −1
49 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1
51 1 −1 0 1 1 0 −1 −1 0 −1 1 0 1 1 0 1 0 0 1 1 0 −1 1 0 1 −1 0 −1 1 0
53 1 −1 −1 1 −1 1 1 −1 1 1 1 −1 1 −1 1 1 1 −1 −1 −1 −1 −1 −1 1 1 −1 −1 1 1 −1
55 1 1 −1 1 0 −1 1 1 1 0 0 −1 1 1 0 1 1 1 −1 0 −1 0 −1 −1 0 1 −1 1 −1 0
57 1 1 0 1 −1 0 1 1 0 −1 −1 0 −1 1 0 1 −1 0 0 −1 0 −1 −1 0 1 −1 0 1 1 0
59 1 −1 1 1 1 −1 1 −1 1 −1 −1 1 −1 −1 1 1 1 −1 1 1 1 1 −1 −1 1 1 1 1 1 −1

Properties

The following facts, even the reciprocity laws, are straightforward deductions from the definition of the Jacobi symbol and the corresponding properties of the Legendre symbol.[2]

The Jacobi symbol is defined only when the upper argument ("numerator") is an integer and the lower argument ("denominator") is a positive odd integer.

1. If n is (an odd) prime, then the Jacobi symbol (a/n) is equal to (and written the same as) the corresponding Legendre symbol.
2. If ab  (mod n), then
3.

If either the top or bottom argument is fixed, the Jacobi symbol is a completely multiplicative function in the remaining argument:

4.
5.

The law of quadratic reciprocity: if m and n are odd positive coprime integers, then

6.

and its supplements

7. ,

and

8.

Combining properties 4 and 8 gives:

9.

Like the Legendre symbol:

  • If (a/n) = −1 then a is a quadratic nonresidue modulo n.

But, unlike the Legendre symbol:

If (a/n) = 1 then a may or may not be a quadratic residue modulo n.

This is because for a to be a quadratic residue modulo n, it has to be a quadratic residue modulo every prime factor of n. However, the Jacobi symbol equals one if, for example, a is a non-residue modulo exactly two of the prime factors of n.

Although the Jacobi symbol cannot be uniformly interpreted in terms of squares and non-squares, it can be uniformly interpreted as the sign of a permutation by Zolotarev's lemma.

The Jacobi symbol (a/n) is a Dirichlet character to the modulus n.

Calculating the Jacobi symbol

The above formulas lead to an efficient O(log a log b)[3] algorithm for calculating the Jacobi symbol, analogous to the Euclidean algorithm for finding the gcd of two numbers. (This should not be surprising in light of rule 2.)

  1. Reduce the "numerator" modulo the "denominator" using rule 2.
  2. Extract any even "numerator" using rule 9.
  3. If the "numerator" is 1, rules 3 and 4 give a result of 1. If the "numerator" and "denominator" are not coprime, rule 3 gives a result of 0.
  4. Otherwise, the "numerator" and "denominator" are now odd positive coprime integers, so we can flip the symbol using rule 6, then return to step 1.

In addition to the code below, Riesel[4] has it in Pascal.

Implementation in Lua

function jacobi(n, k)
  assert(k > 0 and k % 2 == 1)
  n = n % k
  t = 1
  while n ~= 0 do
    while n % 2 == 0 do
      n = n / 2
      r = k % 8
      if r == 3 or r == 5 then
        t = -t
      end
    end
    n, k = k, n
    if n % 4 == 3 and k % 4 == 3 then
      t = -t
    end
    n = n % k
  end
  if k == 1 then
    return t
  else
    return 0
  end
end

Implementation in C++

// a/n is represented as (a,n)
int jacobi(int a, int n) {
    assert(n > 0 && n%2 == 1);
    // Step 1
    a = (a % n + n) % n; // Handle (a < 0)
    // Step 3
    int t = 0;   // XOR of bits 1 and 2 determines sign of return value
    while (a != 0) {
        // Step 2
        while (a % 4 == 0)
            a /= 4;
        if (a % 2 == 0) {
            t ^= n;  // Could be "^= n & 6"; we only care about bits 1 and 2
            a /= 2;
        }
        // Step 4
        t ^= a & n & 2;  // Flip sign if a % 4 == n % 4 == 3
        int r = n % a;
        n = a;
        a = r;
    }
    if (n != 1)
        return 0;
    else if ((t ^ (t >> 1)) & 2)
        return -1;
    else
        return 1;
}

Example of calculations

The Legendre symbol (a/p) is only defined for odd primes p. It obeys the same rules as the Jacobi symbol (i.e., reciprocity and the supplementary formulas for (−1/p) and (2/p) and multiplicativity of the "numerator".)

Problem: Given that 9907 is prime, calculate (1001/9907).

Using the Legendre symbol

Using the Jacobi symbol

The difference between the two calculations is that when the Legendre symbol is used the "numerator" has to be factored into prime powers before the symbol is flipped. This makes the calculation using the Legendre symbol significantly slower than the one using the Jacobi symbol, as there is no known polynomial-time algorithm for factoring integers.[5] In fact, this is why Jacobi introduced the symbol.

Primality testing

There is another way the Jacobi and Legendre symbols differ. If the Euler's criterion formula is used modulo a composite number, the result may or may not be the value of the Jacobi symbol, and in fact may not even be −1 or 1. For example,

So if it is unknown whether a number n is prime or composite, we can pick a random number a, calculate the Jacobi symbol (a/n) and compare it with Euler's formula; if they differ modulo n, then n is composite; if they have the same residue modulo n for many different values of a, then n is "probably prime".

This is the basis for the probabilistic Solovay–Strassen primality test and refinements such as the Baillie–PSW primality test and the Miller–Rabin primality test.

As an indirect use, it is possible to use it as an error detection routine during the execution of the Lucas–Lehmer primality test which, even on modern computer hardware, can take weeks to complete when processing Mersenne numbers over (the largest known Mersenne prime as of October 2024). In nominal cases, the Jacobi symbol:

This also holds for the final residue and hence can be used as a verification of probable validity. However, if an error occurs in the hardware, there is a 50% chance that the result will become 0 or 1 instead, and won't change with subsequent terms of (unless another error occurs and changes it back to -1).

See also

Notes

  1. ^ Jacobi, C. G. J. (1837). "Über die Kreisteilung und ihre Anwendung auf die Zahlentheorie". Bericht Ak. Wiss. Berlin: 127–136.
  2. ^ Ireland & Rosen pp. 56–57 or Lemmermeyer p. 10
  3. ^ Cohen, pp. 29–31
  4. ^ p. 285
  5. ^ The number field sieve, the fastest known algorithm, requires
    operations to factor n. See Cohen, p. 495

References

Read other articles:

Abraham ErbBorn(1772-07-12)July 12, 1772Warwick Township, Lancaster County, PennsylvaniaDiedSeptember 6, 1830(1830-09-06) (aged 58)Waterloo, Upper CanadaBurial placeFirst Mennonite Cemetery, Kitchener, Ontario, CanadaKnown forFounder of Waterloo, OntarioSpouse Magdalena Erb ​(m. 1804)​ParentsChristian Erb (father)Maria Scherch (mother) Abraham Erb 1772-1830 historical sign in Waterloo Park Abraham Erb (12 July 1772 – 6 September 1830), som...

 

1989 studio album by Adelaide FerreiraAmantes e MortaisStudio album by Adelaide FerreiraReleased1989Recorded1989GenrePop PortugêsLength2LP 89:05LabelMBPProducerJean Louis MilfordAdelaide Ferreira chronology Entre Um Coco e Um Adeus(1986) Amantes e Mortais(1989) O Realizador está Louco(1996) Amantes e Mortais (known in English as Fast and Far) is Adelaide Ferreira's second album released in 1989. Track listing Portuguese Version Amantes e Mortais Vem Dançar Dava Tudo Na Maior Marlen...

 

Halaman ini berisi daftar Perdana Menteri Antigua dan Barbuda. Ketua Menteri Antigua (1960-1967) # Pejabat Potret Periode Jabatan Afiliasi Politik Mulai Menjabat Akhir Jabatan 1 Vere Bird 1 Januari 1960 27 Februari 1967 Partai Buruh Antigua Premier Antigua (1967-1981) # Pejabat Potret Periode Jabatan Afiliasi Politik Mulai Menjabat Akhir Jabatan 1 Vere Bird(periode ke-1) 27 Februari 1967 14 Februari 1971 Partai Buruh Antigua 2 George Walter 27 Februari 1967 1 Februari 1976 Gerakan Buruh Progr...

Нестор Карбальйо Особисті дані Народження 3 лютого 1929(1929-02-03)   Монтевідео, Уругвай Смерть 22 вересня 1981(1981-09-22) (52 роки)   Сальто, Уругвай Громадянство  Уругвай Позиція захисник Професіональні клуби* Роки Клуб І (г) 1949—1950 «Данубіо»  ? (?) 1951—1955 «Насьйональ»  ? (?) 19...

 

محكمة نيوهامبشير العامة المجالس مجلس شيوخ نيوهامبشير (مجلس أعلى)مجلس نواب نيوهامبشير (مجلس أدنى)  البلد الولايات المتحدة  الموقع الإلكتروني الموقع الرسمي  تعديل مصدري - تعديل   محكمة نيوهامبشير العامة (بالإنجليزية: New Hampshire General Court)‏ هي الهيئة التشريعية لنيوهامبشي

 

Penyuntingan Artikel oleh pengguna baru atau anonim untuk saat ini tidak diizinkan.Lihat kebijakan pelindungan dan log pelindungan untuk informasi selengkapnya. Jika Anda tidak dapat menyunting Artikel ini dan Anda ingin melakukannya, Anda dapat memohon permintaan penyuntingan, diskusikan perubahan yang ingin dilakukan di halaman pembicaraan, memohon untuk melepaskan pelindungan, masuk, atau buatlah sebuah akun. Artikel ini bukan mengenai Partai Demokrasi Indonesia atau Partai Demokrat (Indon...

Suwanee Creek GreenwayThe greenway in 2019Length4.0 miles (6.4 km)LocationSuwanee, Georgia, USATrailheadsGeorge Pierce Park (north) toWestern Gwinnett Bikeway (south)UseCycling and pedestriansSeasonYear roundSurfaceConcreteWebsiteSuwanee Creek Greenway A boardwalk section of the greenway The Suwanee Creek Greenway is a 4.0-mile (6.4 km) multi-use trail under construction in the city of Suwanee, Georgia, in the United States.[1][2] The trail is a hard-surface and mean...

 

Tưởng Trác Khánh蔣卓慶Chức vụ Chủ nhiệm Nhân Đại Thượng HảiNhiệm kỳ20 tháng 1 năm 2020 – nay3 năm, 315 ngàyTiền nhiệmÂn Nhất ThôiKế nhiệmđương nhiệmVị tríThượng Hải Thông tin chungQuốc tịch Trung QuốcSinhtháng 8, 1959 (64 tuổi)Từ Khê, Ninh Ba, Chiết Giang, Trung QuốcNghề nghiệpChính trị giaDân tộcHánTôn giáoKhôngĐảng chính trị Đảng Cộng sản Trung QuốcH

 

Kepulauan KarimunjawaCitra satelit Kepulauan Karimunjawa, September 2019.Kep. KarimunjawaLokasi Kepulauan Karimunjawa di Laut JawaGeografiLokasiLaut JawaKoordinat5°49′9″S 110°27′32″E / 5.81917°S 110.45889°E / -5.81917; 110.45889Koordinat: 5°49′9″S 110°27′32″E / 5.81917°S 110.45889°E / -5.81917; 110.45889KepulauanKepulauan Sunda BesarJumlah pulau27Pulau besarKarimunjawa, Kemujan, Parang, NyamukLuas71 km2Pemerinta...

Туніка інків Ткацтво інків — важлива галузь в економіці імперії Тауантінсую, увібрала в себе традиції підкорених інками андських народів та держав. В результаті вдосконалення досягло високого рівня майстерності. Традиції виробництва тканин за часів інків до тепер зб

 

1990 fantasy book by William Steig This article is about the book. For the film franchise based on the book, see Shrek (franchise). Shrek! First edition cover, designed by William SteigAuthorWilliam Steig[1]IllustratorWilliam Steig[1]Cover artistWilliam SteigCountryUnited StatesLanguageEnglishGenreChildren's literaturePublisherFarrar, Straus and GirouxPublication dateOctober 17, 1990[2]Media typePrint (Paperback and Hardcover)Pages30ISBN978-0-374-36877-7OCLC2...

 

Osachi Hamaguchi Hamaguchi Osachi (japanisch 濱口 雄幸, bzw. in respektvoller Lesung[1] Hamaguchi Yūkō; * 1. Mai 1870 in Kōchi, Provinz Tosa (heute: Präfektur Kōchi), Japan; † 26. August 1931 in Tokio) war ein japanischer Politiker und 27. Premierminister Japans. Inhaltsverzeichnis 1 Leben 2 Anmerkungen 3 Literatur 4 Weblinks 5 Einzelnachweise Leben Attentat auf Hamaguchi Osachi im Bahnhof Tokio, 14. November 1930 Hamaguchi trat zunächst 1895 in den Dienst des Finanzminist...

1992 video game This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Great Greed – news · newspapers · books · scholar · JSTOR (June 2021) (Learn how and when to remove this template message) 1992 video gameGreat GreedNorth American cover artDeveloper(s)NamcoPublisher(s)NamcoPlatform(s)Game BoyReleaseJP: Septembe...

 

1982 Indian filmOdukkam ThudakkamTheatrical release posterDirected byMalayattoor RamakrishnanWritten byMalayattoor RamakrishnanScreenplay byMalayattoor RamakrishnanProduced byM. O. JosephStarringRatheeshKalaranjiniRajkumarK. P. UmmerCinematographyVipin DasEdited byM. S. ManiMusic byG. DevarajanProductioncompanyManjilasDistributed byChalachitraRelease date 12 March 1982 (1982-03-12) CountryIndiaLanguageMalayalam Odukkam Thudakkam is a 1982 Indian Malayalam-language film, directe...

 

Japanese manga series by Yasuhiro Kanō Pretty FaceFirst tankōbon volume coverプリティフェイス(Puriti Feisu)GenreRomantic comedy[1] MangaWritten byYasuhiro KanōPublished byShueishaEnglish publisherNA: Viz MediaImprintJump ComicsMagazineWeekly Shōnen JumpDemographicShōnenOriginal runMay 14, 2002 – June 9, 2003Volumes6 (List of volumes) Pretty Face (Japanese: プリティフェイス, Hepburn: Puriti Feisu) is a Japanese manga series written and illustrated by Ya...

Universitas ParamadinaLogo Universitas ParamadinaMotoLeadership, Entrepreneurship, EthicsJenisPerguruan Tinggi SwastaDidirikan10 Januari 1998RektorProf. Didik Junaidi Rachbini, M.Sc, Ph.D.LokasiUniversitas Paramadina: Jl. Gatot Subroto Kav. 97, Mampang, Jakarta Selatan, DKI Jakarta 12790. Paramadina Graduate School: The Energy 22nd Floor, SCBD Lot. 11A, Jl. Jend. Sudirman Kav. 52-53, Senayan, Kebayoran Baru, Jakarta Selatan, DKI Jakarta 12190.Situs webwww.paramadina.ac.id Universitas Paramadi...

 

Local civic body in Guntur, Andhra Pradesh, India Guntur Municipal CorporationGuṇṭūru nagara pālaka saṅghamuగుంటూరు నగర పాలక సంఘముTypeTypeMunicipal corporation of the Guntur HistoryFounded1866; 157 years ago (1866)LeadershipMayorKavati Siva Naga Manohar Naidu (YSRCP) Deputy MayorVanama Bala Vajrababu (YSRCP), Shaik Sajeela (YSRCP) Corporation CommissionerKeerthi Chekuri StructurePolitical groupsGovernment (46)   YSRCP (44) &...

 

Mythical war This article includes a list of general references, but it lacks sufficient corresponding inline citations. Please help to improve this article by introducing more precise citations. (November 2021) (Learn how and when to remove this template message) Emperor Jinmu on the cover of the first national census, 1920. Jimmu's Eastern Expedition (神武東征) refers to a series of stories in which Emperor Jimmu became the first emperor of Japan, after defeating Nagasunehiko, who had r...

6th episode of the 5th season of Glee Movin' OutGlee episodeEpisode no.Season 5Episode 6Directed byBrad FalchukWritten byRoberto Aguirre-SacasaFeatured music Movin' Out Piano Man My Life Honesty An Innocent Man Just the Way You Are You May Be Right Production code5ARC06Original air dateNovember 21, 2013 (2013-11-21)Guest appearances Tyra Banks as Bichette Lauren Potter as Becky Jackson Erinn Westbrook as Bree Trisha Rae Stahl as Millie Rose Andi Chapman as Arwyyd Johnson M...

 

American entomologist, geologist and zoologist Charles Henry FernaldBorn(1838-03-16)March 16, 1838Mount Desert, Maine, U.S.DiedFebruary 22, 1921(1921-02-22) (aged 82)Amherst, Massachusetts, U.S.Alma materBowdoin CollegeUniversity of MaineAnderson School of Natural HistoryKnown forWork on the eradication of the gypsy moth, first college-level teacher of economic entomologySpouseMaria Elizabeth FernaldScientific careerFieldsEconomic entomology, lepidopterology, geology, natural h...

 
Kembali kehalaman sebelumnya