Each answer here was worked out by hand, without RatMath, before the RatMath code was written. Where the arithmetic is long, the working says how it was checked.
1.Bézout coefficients
Find gcd(252,198) and integers x,y with 252x+198y=gcd(252,198).
Answer
252=1⋅198+54, 198=3⋅54+36, 54=1⋅36+18, 36=2⋅18. So the gcd is 18, and back-substituting gives 18=4⋅252−5⋅198.
2.Linear congruence
Solve 17x≡3(mod29).
Answer
17⋅12=204=7⋅29+1, so 17−1≡12 and x≡36≡7(mod29).
3.Chinese remainder theorem
Find the least positive x with x≡2(mod3), x≡3(mod5), x≡2(mod7).
Answer
x≡2(mod21) from the first and third; 2,23,44,…: 23 is 3mod5. So x=23 (mod 105).
4.Euler's totient
Compute φ(360).
Answer
360=23⋅32⋅5: φ=360⋅21⋅32⋅54=96.
5.Fermat's little theorem
Find 3100mod7.
Answer
36≡1, 100=6⋅16+4, so 3100≡34=81≡4.
6.Divisor functions
Compute σ(28) and τ(28). Is 28 perfect?
Answer
Divisors 1, 2, 4, 7, 14, 28: τ=6, σ=56=2⋅28, so 28 is perfect.
7.Möbius function
Compute μ(30) and μ(12).
Answer
30=2⋅3⋅5 has three distinct primes: μ=−1. 12 has a square factor: μ=0.
8.Legendre symbol
Evaluate (115).
Answer
By reciprocity (115)=(511)=(51)=1. (Indeed 42=16≡5.)
9.Jacobi symbol
Evaluate the Jacobi symbol (152). Is 2 a square mod 15?
Answer
(32)(52)=(−1)(−1)=1, but 2 is not a square mod 3, so it is not a square mod 15: the Jacobi symbol 1 does not imply a square.
10.Square roots mod p
Solve x2≡10(mod13).
Answer
62=36=2⋅13+10, so x≡±6, that is 6 and 7.
11.Order of an element
Find the multiplicative order of 2 modulo 11.
Answer
The order divides 10. 22=4, 25=32≡10≡1, so the order is 10.
12.Primitive roots
Find the least primitive root modulo 13.
Answer
24=16≡3, 26=64≡12≡−1, so 212/2,212/3=1: 2 has order 12 and is a primitive root.
13.Fermat numbers
Factor F5=232+1.
Answer
Euler: 232+1=641⋅6700417 (both prime).
14.Carmichael numbers
Show 561 is composite but a560≡1(mod561) for every a coprime to 561.
Answer
561=3⋅11⋅17, and 2,10,16 all divide 560 (Korselt), so the Carmichael function λ(561)=lcm(2,10,16)=80 divides 560.
15.Sums of two squares
Write 65 as a sum of two squares in every way (a≥b>0).
Answer
65=5⋅13=(22+12)(32+22): 65=82+12=72+42.
16.Linear Diophantine equations
Find all solutions of 3x+5y=47 in non-negative integers.
Answer
47−5y≡0(mod3) needs y≡1(mod3): y=1,4,7 give x=14,9,4.
17.Frobenius number
Chicken nuggets come in boxes of 6, 9 and 20. What is the largest number that cannot be bought exactly?
Answer
44 = 24 + 20, 45 = 5·9, 46 = 6 + 40, 47 = 27 + 20, 48 = 8·6, 49 = 9 + 40 are all possible, and any later number adds 6 to one of these. 43 is not possible (43, 23 and 3 are not sums of 6s and 9s). Answer: 43.
18.Continued fractions and Pell's equation
Find the continued fraction of 13, and the smallest positive solution of x2−7y2=1.
Answer
13=[3;1,1,1,1,6]. For D=7: 7=[2;1,1,1,4], convergent 8/3: 64−63=1, so (8,3).