(* 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 numbers from the problems ******** *) problem1m := 282006548310266500521595796103735803923312201934083188120704096090962921710642902266245001 problem1w := 169171645092006578241300799123542803090460485666471678762142554544526241248418101659881815 problem1N := 340424449758185542695947485837945311955875942240280273796932383801516352255982079556106287 problem2N := 51300594275226581813688476659949247556215009836233 problem2e := 65537 problem2c := 42532231210824048250926791283200710247749142953927 problem3Nb := 49703407978872135768369150951737194603841663052986938247511157126794635921277619 problem3Nc := 48394585785126752760098222942433754518772506574482068079987934034981215730453293 problem3Nd := 37048466581842421945081537172098726013070671280095643279361407260434395186752267 problem3cb := 05905364385466286295586251025237668938472190855132358966957728964323606634400251 problem3cc := 21138220486961146446206617482811850561629767638994082201111978852676605086081807 problem3cd := 27157125477984404879431019780288127319483825029543848767280738662683083014939218 problem6N := 488419441734583556321985415212612123740359939381088965700730231638206554681394177 problem6s2 := 364578471930898294925524638136447727960007605573204140075455802888652544203808336 problem6u12:= 419987940537002829673554859623446087647247049378701209589622515994832674140645748 problem6u22:= 270893145623915322344834242328268768371424519375297223857305039560421032101793802 problem6u32:= 001204179001250513038323769136188667129468312291612708387897338022926559640599640 problem6u42:= 295360259330799676568102779994887111797263481168605647699269117672956353312755331 problem6u1 := 368836285783665928691160226566669484193845816214794656578305054442600293140251910 problem6su2:= 061162076090849776429311938634702834494489117638106960807555056103441302535633013 problem6su3:= 304092941078945109049230333889649788448145691132625713366641946452437843830720793 problem6su4:= 174908257541270590422202403049766598633440061550219493518183063157021792026188460 problem7cN := 45737 * 54377 problem7d := 1657960491 (* ******* Here is code for decoding a number string, for problems 2 and 3 ******* *) NumbersToString[list_] := StringJoin[FromLetterNumber[list + 1]] NumberStringList[n_] := PadLeft[IntegerDigits[n], 2*Ceiling[Length[IntegerDigits[n]]/2]] NumberListConvert[list_] := Table[FromDigits[list[[2 i - 1 ;; 2 i]]], {i, 1, Length[list]/2}] NumberToString2[n_] := NumbersToString[NumberListConvert[NumberStringList[n]]] (*This will convert an integer into its corresponding letter string,where a=00,b=01,...,z=25*) NumberToString2[0704111114] (*This should return the string "hello"*) (* ********* 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 50 digits or fewer *) 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 *) CubeRoot[64] (* This will compute the cube root of 64. You can also obtain this as 64^(1/3), but fractional powers can sometimes behave unexpectedly because of how Mathematica handles complex numbers. *)