Question: can you help me with whose problems in sagemath? thank you Problem 1 Write a function that takes in an integer and determines whether it


can you help me with whose problems in sagemath? thank you
Problem 1 Write a function that takes in an integer and determines whether it is a prime (i.e. has no divisors other than 1 and itself). There is a built in function is_prime that does this, but don't use it or any other built-in functions. Use your function to determine whether 2 - 1 is prime. Include in your Jupyter notebook a short written explanation of the algorithm you are using to test whether numbers are prime. Problem 2 Write a function that takes as input an integer n and returns its factorization into prime numbers. The output should be a list of the prime factors, with each prime p appearing k times in the list where k is the largest power of p such that pk divides n. The order of the elements of the list does not matter. For instance, if n = 12, any of (2,2,3), (2,3,2], or (3,2,2] would be vaild outputs. Do not use the built-in factor function. Test your function on 222 - 1,223 1, and 224 1. Problem 3 (a) Write a function that takes as input a string of characters, and returns the characters in reverse order (either as a list of characters, or as a string). Try your function on "MADWARWOLF". It should return "FLOWRAWDAM" (or a list of these characters). (b) Write a function that takes as input a string of characters, and applies the above reverse cipher, followed by a shift (Caesar) cipher like the one we did in class (shifting by an amount of your choice). How hard would it be to break this combination cipher? Problem 1 Write a function that takes in an integer and determines whether it is a prime (i.e. has no divisors other than 1 and itself). There is a built in function is_prime that does this, but don't use it or any other built-in functions. Use your function to determine whether 2 - 1 is prime. Include in your Jupyter notebook a short written explanation of the algorithm you are using to test whether numbers are prime. Problem 2 Write a function that takes as input an integer n and returns its factorization into prime numbers. The output should be a list of the prime factors, with each prime p appearing k times in the list where k is the largest power of p such that pk divides n. The order of the elements of the list does not matter. For instance, if n = 12, any of (2,2,3), (2,3,2], or (3,2,2] would be vaild outputs. Do not use the built-in factor function. Test your function on 222 - 1,223 1, and 224 1. Problem 3 (a) Write a function that takes as input a string of characters, and returns the characters in reverse order (either as a list of characters, or as a string). Try your function on "MADWARWOLF". It should return "FLOWRAWDAM" (or a list of these characters). (b) Write a function that takes as input a string of characters, and applies the above reverse cipher, followed by a shift (Caesar) cipher like the one we did in class (shifting by an amount of your choice). How hard would it be to break this combination cipher
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
