45 views

Original Title: cw2

Uploaded by mathmo

- 25 Hardest Questions From the GMAT Club Forum
- NumberTheory a.saikia
- TrainingICPC
- UK Mathematical Olympiad for Girls (24 June 2011)
- MTAP Reviewer Grade 3
- mostparadoxistmathematician PDF
- Sucecion de Fibonacci
- chap04
- mathgen-1430645045
- absalg13
- Appt Itude
- Integration and Diferential Equations in Computer Algebra
- tut02sols(1)
- A Sufficient Condition for Disproving Descartes's Conjecture on Odd Perfect Numbers
- 1 Chapter (Maths)
- Simple+C+Programs
- Lucas
- 12soln
- 2050Lec10
- 13150 Unit 18

You are on page 1of 4

Phil Ramsden

Deadline: 29 and 30 November 2012 Your coursework must contain a cover sheet and the following signed pledge that it is your own work. This signature signies that this represents my own work, completed independently, without assistance except where acknowledged and properly referenced. Signed: CID: Name: Tutorial Group:

This assignment, together with all the other resources youll need, are available in Blackboard, at http://learn.imperial.ac.uk/

A Very, very important. The online resources, including this document, were written in LTEX, and the text contains certain characters that Maple doesnt recognise, and that can corrupt your les. So be very careful about copying and pasting text from them into Maple; indeed, avoid doing so wherever you can. Copying and pasting Maple code is ne.

Part 1

The highest common factor (HCF) or greatest common divisor (GCD) of two numbers is the highest number that goes into them both. Thus the HCF of 36 and 60 is 12, and the HCF of 35 and 60 is 5. One way to nd it is to do a prime factorisation of both numbers and then see what factors occur in both. However, once numbers get at all large, factorisation starts to take a long time: no genuinely rapid algorithms for factorisation are known (and it may well be that none exist). So if we want a rapid algorithm for nding HCFs, it must be one that avoids integer factorisation. Amazingly, such an algorithm has been known for over two millennia; its called Euclids algorithm. To nd the HCF of a and b, we Set r1 = a, r2 = b. For each i >= 2, let ri+1 be the remainder when ri1 is divided by ri . When ri+1 = 0, the HCF is ri . 1

Question 1

(i) Write some Maple code (for full marks, a procedure) that takes two positive integers and returns their highest common factor. (ii) Test your code on the integers a = 188613 and 136458; the HCF should be 171. (iii) Rewrite your code so that it displaysor, for full marks, returnsall the intermediate remainders as well as the nal highest common factor. How many steps does the algorithm take to get to 171? (iv) Use your code on the Fibonacci numbers F27 = 196418, F26 = 121393: how many steps does this take? Show that this is the smallest pair of numbers to require this many steps. (Hint: imagine running the algorithm in reverse from 1, taking the worst case each time.)

Part 2

If h is the HCF of a and b, then there exist and such that h = a + b. So for example in the case a = 35, b = 60 we have a HCF of 5, and 5 35 + 3 60 = 175 + 180 = 5. Euclids algorithm can be extended to nd the values of and , as follows: Set r1 = a, 1 = 1, 1 = 0. Set r2 = b, 2 = 0, 2 = 1. For each i >= 2, let ri+1 be the remainder when ri1 is divided by ri . If the quotient from this division sum is qi , then let i+1 = i1 qi i ; i+1 = i1 qi i ; . At every stage, i a+i b = ri . When ri+1 = 0, the HCF is h = ri , and i a+i b = h.

Question 2

(i) Extend your Maple code to nd and as well as h. Test on the integers a = 188613 and 136458, showing all intermediate remainders and the associated values of and (again, for full marks these should be returned). (ii) Given that n = 211583 and e = 4177, nd d > 0 such that d e 1 (mod n). For full marks, you should do this using your program from part (i). The rst two questions carry 80% of the marks.

We can show that it is indeed hard to factorise large integers, by generating two ten-digit primes and asking Maple to factorise their product: p1 := nextprime(3564965214); p2 := nextprime(3914893877); n := p1*p2; ifactor(n); and then repeating for larger and larger prime pairs.

Question 3

(i) Repeat for 24, 32, 40, 48, 56 and 64-digit pairs of primes. At what point does the factorisation stop being feasible? (ii) Test your primes and your values of n for primality using the Maple function isprime. Does this run into the same kinds of problems? What do you think is the reason for this? Question 3 parts (i) and (ii) carry 5% of the marks. Go to Blackboard and nd the explanation of the RSA encryption algorithm. Now: my 170-digit modulus, n, is 46862651776313668832684618638310007043245135907468247470585960688008 18053474200526957854883187814853515873878978950671057936752518363638 9872513135592162572724499935530721 and my encryption key, e, is 59. (iii) Encrypt your email address using my modulus and encryption key, and send it to me in an email. Youll need to encode it numerically rst (note: you must use the numerical encoding suggested on the RSA handout, or I wont be able to recover your email address). In your email, please send your ciphertext as a large integer; you neednt convert it back into characters. (iv) Send me a public key, in the form of: a modulus of the form n = p1 p2 , where p1 and p2 are prime; the modulus should have between 120 and 200 digits; an encryption key, which can be quite small, but whose HCF with (n) = (p1 1) (p2 1) must be 1. I shall then send you a message, which you should decrypt. When you know what the message is, send me the plaintext in a further email 3

Question 3 parts (iii) and (iv) carry 5% and 10% of the marks respectively. IMPORTANT NOTES: If I can factorise the number you send me, Ive cracked your cipher, and youre a dead spy. Dead spies get zero for Question 3 (iv). This is an iron rule, so be careful; think before you send! If you can factorise my modulus, youve cracked my cipher. Anyone who does this gets an automatic 100% for the whole of this project, no matter how well or badly they do on the rest. (2010s modulus, which was 160 digits long, was successfully factorised by one student.)

You may nd some of the following Maple keywords useful, amongst others: proc, if, while, for, mod, iquo, irem, modp, mods, nextprime, rand, ifactor, isprime, time, &^, nops, seq, map. From the StringTools package: Char, Ord, Explode, Implode. From the ListTools package: Search, DotProduct.

- 25 Hardest Questions From the GMAT Club ForumUploaded byarpitgarg1989
- NumberTheory a.saikiaUploaded byPalaniappan S
- TrainingICPCUploaded byDoan Tuan Anh
- UK Mathematical Olympiad for Girls (24 June 2011)Uploaded byhabarnaitu
- MTAP Reviewer Grade 3Uploaded byClarisa Ella
- mostparadoxistmathematician PDFUploaded bykoki74
- Sucecion de FibonacciUploaded byLeaj Airam
- chap04Uploaded byguitarist^_^
- mathgen-1430645045Uploaded bySam
- absalg13Uploaded byLeo Schizo
- Appt ItudeUploaded byrush2arthi
- Integration and Diferential Equations in Computer AlgebraUploaded byBeatriz Emilia Bolivar
- tut02sols(1)Uploaded byNatasha Chandra
- A Sufficient Condition for Disproving Descartes's Conjecture on Odd Perfect NumbersUploaded byBebita-Dris Jose Arnaldo
- 1 Chapter (Maths)Uploaded byJanaki Krishnan
- Simple+C+ProgramsUploaded byShanmukh Gollapudi
- LucasUploaded byGREATIA BRITAINIS
- 12solnUploaded byalpha2122
- 2050Lec10Uploaded byMuhammad Adnan Malik
- 13150 Unit 18Uploaded byNeeraj Jangid
- Concept...Total FundasUploaded bySanat Mohanty
- wxy95Uploaded byAnonymous 0U9j6BLllB
- Chapter 2 Number Patterns and SequencesUploaded byThiriloganathan Murugan
- Congr UencesUploaded byFabi SuJu
- Rsa and Elgamal AlgorithmsUploaded byAbhinav Chinnala
- nullUploaded byapi-26199179
- lesson planUploaded byAinol Bazlin Farhana
- v1_n1Uploaded byMarcelo Barbosa
- calendar for weeblyUploaded byapi-245260323
- st assessment data and analysisUploaded byapi-295344110

- CH8_1.pdfUploaded byarasteh12
- WRES3301 AssignmentUploaded bysalaheamean
- 10[1].1.1.58.9599Uploaded bysaravanaanhcl1
- 3b Ipsec VPNUploaded byMark Brown
- Sample paper for IJECER- LORENZOUploaded byCholin Lorenzo
- RSA and IDEA Security AlgorithmsUploaded byzahra.shuaibi
- Analytical Study of Modified RSA Algorithms for Digital SignatureUploaded byEditor IJRITCC
- ExploringIBMDB2 EncryptionTechnology Marcin BasterIBM POLSKAUploaded byfallenlord
- rsa1Uploaded bymahahussien_874778
- Cryptography and Network Security - Lecture Notes, Study Materials and Important questions answersUploaded byBrainKart Com
- CCNA Security 07Uploaded byChanchan Chan
- [smtebooks.com] Foundations of Blockchain 1st Edition.PdfUploaded byLuke Lu
- Secure Active Detection Data Routing Protocol in ManetsUploaded byIRJET Journal
- RSAUploaded bynikhilsmenon
- vjchavdaUploaded byNir Infosys
- RsaUploaded byshreenl
- CrypToolScript-enUploaded byJavier Alfaro Pastor
- 13 CryptoUploaded byBùi Văn Thủ
- Digital Signature StandardUploaded byYasir Iqbal
- Cryptography Homework HelpUploaded byassignmentpedia
- Modified Rabin Cryptosystem through Advanced Key Distribution SystemUploaded byInternational Organization of Scientific Research (IOSR)
- Bluetooth Door Locking MechanismUploaded bydc46and2
- Image Encryption Rsa2Uploaded byakash rawat
- AshishUploaded byhktiwari88
- Question_&_Answer.pdfUploaded byKalyan Das
- Ne7207 Nis Unit 3 Question BankUploaded byalgatesgiri
- Blockchain GuideUploaded byKaique Silva
- LSB RSAUploaded byvin
- Computer Networks Lab Manual LatestUploaded byImran
- CSE3482 Final Winter2016Uploaded byJoseph Wu