{VERSION 5 0 "IBM INTEL NT" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 261 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 262 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 265 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 266 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 268 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 269 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 270 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 271 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 272 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 273 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 274 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 275 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 276 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 277 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 278 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 279 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 280 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 281 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 282 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 283 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 284 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 285 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 286 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 287 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 288 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 289 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 290 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 291 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 292 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 293 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 294 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 295 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 296 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 297 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 298 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 299 "" 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 300 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 301 "" 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 302 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 303 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 304 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Heading 1 " -1 3 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 4 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 256 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Title" -1 257 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }3 1 0 0 12 12 1 0 1 0 2 2 19 1 }} {SECT 0 {EXCHG {PARA 257 "" 0 "" {TEXT -1 18 "Maple Worksheet #2" }}} {SECT 1 {PARA 3 "" 0 "" {TEXT -1 41 "Assigning a value to a variable i n Maple." }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 17 "An example of an " }{TEXT 256 10 "assignment" } {TEXT -1 1 " " }{TEXT 257 9 "statement" }{TEXT -1 4 " is:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "x:=2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 299 17 "Note that we use " }{TEXT 300 2 ":=" }{TEXT 301 56 " for assignments. Using = will not work for assignments." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "This ha s the effect of " }{TEXT 261 9 "assigning" }{TEXT -1 10 " 2 to the " } {TEXT 260 8 "variable" }{TEXT -1 54 " x. To see what x is we execute t he following command:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "x; " }{TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 17 "You may use as a " }{TEXT 258 8 "variable" }{TEXT -1 5 " (or " }{TEXT 259 4 "name" } {TEXT -1 196 ") any letter followed by a list of numbers or letters wi th no spaces. And note that Maple is case sensitive, that is, it disti nguishes between lower and upper case letters. Here are some examples. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "var:=3;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "x*var;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "x1:=7;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "va r1:=10;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "x1*var1;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "bigprime:=nextprime(10^100); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "littleprime:=prevprime( 1000);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "m:=bigprime*littl eprime;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "ifactor(m);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "floor(evalf[100](sqrt(m))); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 24 "Colons ver sus Semicolons" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 395 "If an assignmen t statement or other type of statement is followed by a colon then the output is suppressed. If a statement is followed by a semicolon the o utput is shown if there is any. In some case there is no output. This \+ may happen if Maple is unable to perform some operations. The colon is useful when you don't want to see the output which may be too large t o be meaningful.Some examples:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "x:=22:" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 2 "x;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "var1:=5:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "var2:=100;" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "var1*var2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "p:=nextprime(10^100):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "isprime(p);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 2 "p;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 9 " do loops" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 4 "The " }{TEXT 290 7 "for..do" } {TEXT -1 42 " statement is best explained by examples. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 302 21 "Read This Carefully : " }{TEXT -1 67 " When typing such statements, after typing the first line hold the " }{TEXT 263 5 "shift" }{TEXT -1 28 " key down while hi tting the " }{TEXT 262 6 "return" }{TEXT -1 69 " key. This will suppre ss the prompt on the next line. Continue using " }{TEXT 264 14 "shift \+ + return" }{TEXT -1 45 " till you do the last line and then just hit \+ " }{TEXT 265 6 "return" }{TEXT -1 4 ". " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 37 "Here's a simple example of a do lo op:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 56 "for i from 1 to 4 do \n print(i,i^2,i^3,\"hello\");\nend do:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 16 "Another example:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 94 "for j from 1 to 10 do \n p:=ithprime(j):\n print(cat(`The `,j, `-th prime is `,p,`.`));\nend do:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "Change the colon after " }{TEXT 303 6 "end do" }{TEXT -1 70 " in t he above to a semi-colon and execute again to see the difference." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 2 "A \+ " }{TEXT 268 7 "repunit" }{TEXT -1 161 " is a number whose decimal rep resentations uses only the digit 1. For example, 1, 11, 111, 1111, 111 11, and 111111 are repunits. An n digit repunit has the form " } {XPPEDIT 18 0 "(10^n-1)/9;" "6#*&,&)\"#5%\"nG\"\"\"F(!\"\"F(\"\"*F)" } {TEXT -1 94 ". It is an interesting open problem to determine which re punits are primes. Let's check a few:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 74 "for n from 2 to 20 do\n k:= (10^n-1)/9:\n print(n, \+ k, isprime(k));\nend do:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 169 "So w e found only 11 and the one repunit with 19 ones. The rest up to leng th 20 are all composite.\n\nOne can also have loops inside of loops. A s in the following example:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 93 "for i from 2 to 4 do\n for j from 2 to 4 do\n print(i,j, `--`, \+ igcd(i,j));\n end do;\nend do;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 59 "Let's find the perfect numbers less than or equal to 10000:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "with(numtheory):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 84 "for n from 2 to 10000 do\n if sigm a(n) - n = n then \n print(n);\n end if;\nend do:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 32 "The if.. then..end if Statement" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 28 "Consider once more the loop:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 93 "for j from 1 to 10 d o \n p:=ithprime(j):\n print(cat(`The`,j,`-th prime is `,p,`.`));\ne nd do:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 115 "Suppose I want to exit this \"loop\" as soon as I get a prime greater than 10. We can use th e conditional statement " }{TEXT 266 18 "if..then...end if " }{TEXT -1 18 "together with the " }{TEXT 267 5 "break" }{TEXT -1 23 " stateme nt--as follows:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 116 "for j f rom 1 to 10 do \n p:=ithprime(j):\n if p > 10 then break; end if;\n \+ print(`The`,j,`-th prime is `,p);\nend do:" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 89 "Suppose I only want to print out primes p satisfying p \+ mod 4 = 1. We can do it this way." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 92 "for j from 1 to 10 do \n p:=ithprime(j):\n if p mod 4 = 1 then \n print(p);\n end if;\nod:" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 44 "Suppose we want to find the Mersenne primes " } {XPPEDIT 18 0 "2^n-1;" "6#,&)\"\"#%\"nG\"\"\"F'!\"\"" }{TEXT -1 42 " f or n up to 100. Here's one way to do it:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 79 "for n from 2 to 100 do\n if isprime(2^n-1) then prin t(n,2^n-1); end if;\nend do;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 166 " Let's return to the search for prime repunits: The following will work a little better than our previous program. This time we only print th e repunits that are prime." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 109 "for n from 2 to 100 do\n k:= (10^n-1)/9:\n if isprime(k) = true then print(n,k, ` is prime`); end if;\nend do:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 199 "It is not too difficult to show that if n is compos ite then a repunit of length n is not prime. So in searching for prime repunits we may just look at primes. There are a couple of ways to do this: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 120 "for n from 1 t o 320 do\n if isprime(n) then \n k:=(10^n-1)/9;\n if isprime(k) th en print(n,k); end if;\n end if;\nend do;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 31 "The following method is faster:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 106 "for t from 2 to 70 do\n n:=ithprime(t); \n k: =(10^n-1)/9;\n if isprime(k) then print(n,k); end if;\nend do:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 273 51 "There have been only 7 repunit primes found so far." }{TEXT -1 32 " The lengths \+ of those found are " }{TEXT 269 1 " " }{TEXT -1 93 "2, 19, 23, 317, 1 ,031, 49081, and 86453. Actually the last two have only been proved t o be " }{TEXT 271 14 "probably prime" }{TEXT -1 48 ". Note that for la rge numbers the Maple command " }{TEXT 270 7 "isprime" }{TEXT -1 15 " \+ is actually a " }{TEXT 272 30 "probabilistic primality tester" }{TEXT -1 2 ". " }}}{EXCHG {PARA 256 "" 0 "" {TEXT -1 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 51 "Addition Using for..do..end do and if..then..en d if" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "restart: " }{TEXT -1 67 "This command clears the old variables and also unloads the package " }{TEXT 291 9 "numtheory" }{TEXT -1 1 "." }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 90 "We first add the primes \+ less than 1000. There are many ways to do this. Here are two ways:" } {MPLTEXT 1 0 7 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 97 " S1:=0:\nfor n from 1 to 1000 do\n if isprime(n) = true then\n S1: =S1 + n:\n end if;\nend do:\nS1;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "Note that the equation " }{TEXT 292 12 "S1:= S1 + n " }{TEXT -1 13 "means to add " }{TEXT 293 2 "S1" }{TEXT -1 4 " to " }{TEXT 294 1 " n" }{TEXT -1 41 " and then put the corresponding value in " }{TEXT 295 2 "S1" }{TEXT -1 42 ". -- This wipes out the previous value of " } {TEXT 296 2 "S1" }{TEXT -1 2 ". " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 28 "Here's another way to do it:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 109 "S2:=0:\nfor j from 1 to 100 0 do\n p:=ithprime(j):\n if p > 1000 then break; end if;\n S2:= S2 \+ + p:\nend do:\nS2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "S1-S2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "Let's use this method to compute the sum " }{XPPEDIT 18 0 "Sum(1/n,n = 1 .. 1000);" "6#-%$SumG6$*&\"\"\"F'%\"nG!\"\"/F(;F'\"%+ 5" }{TEXT -1 46 ". Note that the answer is a rational number. " }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "S3:=0:\nfor n from 1 to 1000 do\n S3:=S3 + 1/n:\nend do:\nS3;\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "To see approximately how big S3 is we use evalf:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "evalf(S3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 " " }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 19 "How \+ to count things" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 118 "Let's count the number of primes less than or equal to 1000. We begin with a \"counter\" which we will arbitrarily call \+ " }{TEXT 297 5 "count" }{TEXT -1 76 ". We set it to 0 to begin and the n when we come across a prime, we add 1 to " }{TEXT 304 5 "count" } {TEXT -1 25 " by using the assignment " }{TEXT 298 18 "count:= count + 1;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 104 "count:=0:\nfor n fr om 1 to 1000 do\n if isprime(n) = true then \n count:=count+1:\n end if;\nend do:\ncount;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 45 "We can c heck this using the builtin function " }{TEXT 274 2 "pi" }{TEXT -1 1 " :" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "with(numtheory):\n" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "pi(1000);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 114 "Now let's count the number of positive integer s less than 348 that are relatively prime to 348. Note that this is " }{XPPEDIT 18 0 "phi(348);" "6#-%$phiG6#\"$[$" }{TEXT -1 1 "." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 85 "c:=0:\nfor n from 1 to 348 d o\n if igcd(n,348) = 1 then \n c:=c+1:\n end if:\nend do:\nc;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 52 "We check this using the built-in E uler phi function:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "phi(34 8);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 1 " " }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 22 "Homewor k Assignment #2" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT 282 38 "Getting started with title and format:" }{TEXT -1 62 " As in Assignment #1 open a new Maple worksheet. Click on the " } {TEXT 275 1 "T" }{TEXT -1 156 " on the menu bar. This will allow you t o insert text. Next go to the pull down menu on the left side where it says P Normal. Pull this down till you get to " }{TEXT 276 7 "Title. \+ " }{TEXT -1 9 "Now type " }{TEXT 277 25 "Homework Assignment # 2. " } {TEXT -1 72 " Then hit return and type your name. Then click on the bu tton that says " }{TEXT 278 2 "[>" }{TEXT -1 32 " on the menu bar. Nex t click on " }{TEXT 279 1 "T" }{TEXT -1 16 " again and type " }{TEXT 280 9 "problem 1" }{TEXT -1 16 ". Now click on " }{TEXT 281 3 "[> " } {TEXT -1 19 " again. Then solve " }{TEXT 283 9 "problem 1" }{TEXT -1 45 ". Similarly label each problem in this way.\n\n" }{TEXT 284 11 "pr oblem 1. " }{TEXT -1 24 "A positive integer n is " }{TEXT 285 8 "abund ant" }{TEXT -1 65 " if the sum of the proper divisors of n is greater \+ than n. It is " }{TEXT 286 9 "deficient" }{TEXT -1 98 " if the sum of \+ the proper divisors of n is less than n. Find \na. the number of abun dant integers " }{XPPEDIT 18 0 "n <= 10000;" "6#1%\"nG\"&++\"" }{TEXT -1 1 "," }}{PARA 0 "" 0 "" {TEXT -1 36 "b. the number of deficient int egers " }{XPPEDIT 18 0 "n <= 10000;" "6#1%\"nG\"&++\"" }{TEXT -1 40 ", and\nc. the number of perfect integers " }{XPPEDIT 18 0 "n <= 10000; " "6#1%\"nG\"&++\"" }{TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT 287 10 "problem 2." }{TEXT -1 1 " " }}{PARA 0 " " 0 "" {TEXT -1 29 "a. Find the number of primes " }{XPPEDIT 18 0 "n < = 10000;" "6#1%\"nG\"&++\"" }{TEXT -1 53 " such that n mod 4 = 1.\nb. \+ Find the number of primes " }{XPPEDIT 18 0 "n <= 10000;" "6#1%\"nG\"&+ +\"" }{TEXT -1 25 " such that n mod 4 = 3.\n\n" }{TEXT 288 9 "problem \+ 3" }{TEXT -1 39 ". Find the number of positive integers " }{XPPEDIT 18 0 "x <= 10000;" "6#1%\"xG\"&++\"" }{TEXT -1 11 " such that " } {XPPEDIT 18 0 "x^2+1;" "6#,&*$%\"xG\"\"#\"\"\"F'F'" }{TEXT -1 13 " is \+ prime. \n\n" }{TEXT 289 9 "problem 4" }{TEXT -1 28 ". For each positiv e integer " }{XPPEDIT 18 0 "n <= 20;" "6#1%\"nG\"#?" }{TEXT -1 24 " fi nd the largest prime " }{XPPEDIT 18 0 "p <= 10^n;" "6#1%\"pG)\"#5%\"nG " }{TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 1 " " }}}}}{MARK "6" 0 }{VIEWOPTS 0 0 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }