Gratis å bruke, uten konto

Kalkulator for den kinesiske restklasseteoremet

Løs et system av kongruenser og se den minste ikke-negative løsningen med samlet modulus. Også kompatible moduli som ikke er primiske, fungerer; motstridende systemer forklares.

Skriv én kongruens per linje som rest, modul. Eksempel: 2, 3 betyr x ≡ 2 (mod 3). Du kan også skrive x ≡ 2 (mod 3). Skriv 2–20 linjer.

Modulene må være heltall på minst 2. Inndata kan være fra −1 000 000 000 000 til 1 000 000 000 000. Kompatible moduler som ikke er primiske støttes. Noen systemer har ingen løsning.

Hvordan bruker jeg kalkulatoren for den kinesiske restteoremet?

Skriv én rest og én modul på hver linje, atskilt med komma, for eksempel 2, 3 for x ≡ 2 (mod 3). Legg til 2–20 linjer og beregn. Resultatet viser den minste ikke-negative x-verdien og den kombinerte modulen.

Veiledning

Slik bruker du Kalkulator for den kinesiske restklasseteoremet

This calculator solves a system of congruences, such as x ≡ 2 (mod 3) and x ≡ 3 (mod 5), with the Chinese remainder theorem. You enter one remainder and one modulus per line, and it returns the smallest non-negative x that fits every line, plus the combined modulus. It also handles moduli that share a factor when the lines agree, and it reports a conflict when no number can fit.

Slik gjør du

  1. Type one congruence per line as remainder, modulus. For example 2, 3 means x ≡ 2 (mod 3). Writing x ≡ 2 (mod 3), or a space instead of the comma, also works.
  2. Use between 2 and 20 lines. Each modulus must be at least 2, and every number must be a whole number from −1,000,000,000,000 to 1,000,000,000,000.
  3. Press Solve system. Read the least non-negative solution, the combined modulus, the final equation and each combining step. Load example fills in a small system.
  4. If the result says the system is incompatible, look at the row it names and change a remainder or modulus. Copy result copies the text.

Eksempler

Two coprime moduli

Du skriver inn
Kongruenser
2, 3; 3, 5
Du får
X
8
Modulus
15
Ligning
x ≡ 8 (mod 15)

8 leaves remainder 2 when divided by 3 and remainder 3 when divided by 5. Every solution has the form 8 + 15k.

Kjørt med verktøyets egen kode.

Three lines combined step by step

Du skriver inn
Kongruenser
2, 3; 3, 5; 2, 7
Du får
Trinn 1
x ≡ 8 (mod 15)
Trinn 2
x ≡ 23 (mod 105)
X
23
Modulus
105

The first two lines combine to 8 mod 15, and adding the third gives 23 mod 105. Check: 23 leaves 2 on division by 3, 3 on division by 5 and 2 on division by 7.

Kjørt med verktøyets egen kode.

Moduli that share a factor but agree

Du skriver inn
Kongruenser
2, 4; 6, 8
Du får
X
6
Modulus
8
Ligning
x ≡ 6 (mod 8)

The moduli 4 and 8 share the factor 4, and both lines agree mod 4, since 2 and 6 both leave 2. The combined modulus is the least common multiple, 8.

Kjørt med verktøyets egen kode.

A system with no solution

Du skriver inn
Kongruenser
1, 4; 2, 6
Du får
Status
incompatible
Konfliktlinje
2
Største felles divisor
2
Differanse
1

The numbers 4 and 6 have gcd 2, but 1 and 2 differ by 1, which is not divisible by 2. In plain terms, x ≡ 1 (mod 4) forces x to be odd while x ≡ 2 (mod 6) forces it to be even.

Kjørt med verktøyets egen kode.

A negative remainder

Du skriver inn
Kongruenser
-1, 5; 3, 7
Du får
X
24
Modulus
35
Ligning
x ≡ 24 (mod 35)

A remainder of −1 mod 5 is treated as 4. Then 24 leaves 4 on division by 5 and 3 on division by 7, and 35 is 5 times 7.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Check number theory homework by comparing your hand-worked answer with the calculator's result.
  • Solve puzzles that ask for a number with given remainders on division by several numbers.
  • Find when two repeating cycles line up, by turning each cycle and offset into a congruence.
  • See how the combining steps work before reading a textbook proof of the theorem.

Begrensninger

  • Each system needs 2 to 20 lines, each modulus must be at least 2, and every typed value must be a whole number with an absolute value of at most 10^12. Decimals are refused.
  • The answer is given as one solution class: the smallest non-negative x and the modulus M. All other solutions are x + kM, but the tool does not list them.
  • When a conflict exists the tool names the first row where it appears, with the gcd and the difference. It does not show a full proof for the whole system.
  • The steps shown are the running combined congruences, not a written-out hand method with extended Euclid tables.

Tips

  • Put your answer back into each line to check it. The remainder after dividing by each modulus should match what you typed.
  • If a system seems to have no solution, look at pairs of moduli that share a factor. Their remainders must agree modulo that common factor.
  • Large numbers are fine. The calculator uses exact whole-number arithmetic, so products far beyond normal calculator limits still come out exact.

Kilder

Vanlige spørsmål

What does the Chinese remainder theorem say?

For moduli that are pairwise coprime, any set of remainders is matched by exactly one number in each block of length equal to the product of the moduli. This tool also covers moduli that share factors, where a solution exists only if the remainders agree on those shared factors.

What is the smallest non-negative solution?

It is the one answer between 0 and M − 1, where M is the combined modulus. Any other answer is found by adding or subtracting multiples of M. For x ≡ 8 (mod 15), the numbers 8, 23, 38 and −7 are all valid.

Can the moduli have a common factor?

Yes. If the lines agree modulo the greatest common divisor, they combine, and the new modulus is the least common multiple. If they disagree, the page reports the system as incompatible and shows the row, the gcd and the difference.

What happens when there is no solution?

The result says the system is incompatible. It shows which line caused the conflict with the earlier lines, the greatest common divisor of the two moduli involved, and the difference between the remainders, which that gcd cannot divide.

Does it accept negative numbers or remainders bigger than the modulus?

Yes for remainders. A remainder is reduced to the range 0 up to the modulus minus 1, so −1 mod 5 becomes 4 and 5 mod 3 becomes 2. Moduli must be at least 2, so negative or zero moduli are refused.

Does the calculator use floating-point numbers?

No. It uses exact BigInt integer arithmetic inside the stated limits. That is why the combined modulus can be very large, for example about 10^24 for two inputs near 10^12, with no rounding.

Are my numbers uploaded?

No. The page says the calculation runs in your browser, and the code works only on the text in the box. Nothing is saved or sent to a server.

Hvordan bruker jeg kalkulatoren for den kinesiske restteoremet?

Skriv én rest og én modul på hver linje, atskilt med komma, for eksempel 2, 3 for x ≡ 2 (mod 3). Legg til 2–20 linjer og beregn. Resultatet viser den minste ikke-negative x-verdien og den kombinerte modulen.

Lastes kongruensene mine opp?

Nei. Beregningen kjøres i nettleseren med eksakt heltallsregning. Verdiene du skriver inn, lastes ikke opp eller lagres av dette verktøyet.

Hva finner det kinesiske restklasseteoremet?

Det kombinerer kongruenser til én gjentakende løsningsklasse. For eksempel blir x ≡ 2 (mod 3) og x ≡ 3 (mod 5) til x ≡ 8 (mod 15).

Kan modulene ha en felles faktor?

Ja, når kongruensene stemmer overens modulo største felles divisor. For eksempel kombineres x ≡ 2 (mod 4) og x ≡ 6 (mod 8) til x ≡ 6 (mod 8). Motstridende systemer rapporteres som uløselige.

Bruker denne kalkulatoren eksakt aritmetikk?

Ja. Den bruker lokal BigInt-heltallsaritmetikk i stedet for flyttall, innenfor inndatagrensene som vises ovenfor.