(* You should be able to copy and paste this text file directly into Mathematica. These notes will be interpreted as commented code. *) (* ********* Here are the strings and numbers from the problems ******** *) problem4text := BRKNARJWQDBTRNBJANCQNENAHKNBCMXPB problem5N := 1359692821 problem5am := 117285016 problem5bc := 823845737 problem7cN := 22592848554175369912787642584639796662881202104422604037797641281978785567961 problem7cphi := 22592848554175369912787642584639796662567375207606558304355492609701088213924 (* ********* Here are some useful commands for powers mod m ******** *) Mod[100,6] (* This will compute 100 modulo 6, yielding 2 *) PrimeQ[201] (* This will test whether 201 is prime, which it is not *) FactorInteger[143] (* This will factor the integer 143, which is 11 times 13 *) (* Mathematica's factorization algorithm knows how to do trial division, Pollard p-1, Pollard rho, quadratic sieving, and elliptic curve factorization, and is typically fairly fast on numbers with less than 50 digits *) PowerMod[2, 10, 99] (* This will compute 2^10 modulo 99. PowerMod is efficient and will use successive squaring *) (* Mod will often also recognize if you give it a power and internally call PowerMod, but it is better to use PowerMod directly *) PowerMod[2, -1, 99] (* This will compute 2^(-1) modulo 99, which is to say, the multiplicative inverse of 2 modulo 99. *) EulerPhi[40] (* This will compute phi(40). *) ChineseRemainder[{1,2,3},{4,5,9}] (* This will compute the smallest positive integer solution to x = 1 mod 4, x = 2 mod 5, x = 3 mod 9 *) (* ********* Here are some useful other commands ******** *) GCD[180, 250] (* This computes the GCD of 180 and 250 *) ExtendedGCD[180, 250] (* This performs the extended Euclidean algorithm, and computes the GCD = 10 along with integers {x,y} such that 180x + 250y = 10 *) PrimitiveRoot[25] (* This calculates the smallest primitive root modulo 25 *) MultiplicativeOrder[7, 25] (* This calculates the order of 7 modulo 25 *) Solve[x^3 == 1, x, Modulus -> 49] (* This calculates all of the numbers x satisfying the equation x^3 = 1 modulo 49 *) Reduce[x^3 == 1, Modulus -> 49] (* This simplifies the equation x^3 = 1 modulo 49, which here will give a list of all the solutions *)