# CMU 15-112 Summer 2019: Fundamentals of Programming and Computer Science Homework 2 (Due Thurs 23-May, at 5pm)

• This assignment is SOLO. This means you may not look at other student's code or let other students look at your code for these problems. See the syllabus for details.

• To start:
1. Create a folder named 'week2'
2. Download hw2.py to that folder
3. Edit hw2.py using Pyzo
4. When you are ready, submit hw2.py to Autolab. For this hw, you may submit up to 20 times (which is way more than you should require), but only your last submission counts.
• Do not use lists, or recursion in this assignment.
• Do not hardcode the test cases in your solutions.

1. nthSteezyPrime [60 pts]
Write the function nthSteezyPrime(n) that takes in a number n, and returns the nthSteezyPrime. A steezy prime is any positive prime number with the following two properties:
• No two consecutive digits are the same.
• All rotations of the number are also primes that satisfy the consecutive digits property mentioned above. In this case, rotation refers to cycling the digits of a number; for example, the rotations of 1234 are 1234, 2341, 3412, and 4123.
To find the nth steezy prime, you'll need to write isPrime (which you can use from the notes) and three other functions:

1. rotateNumber [20 pts]
This function takes a non-negative integer number, x, and rotates that number's digits by one place. This would turn the number 1234 to 4123.

2. isSteezyPrime [30 pts]
This function takes a non-negative integer number, x, and determines whether that number is a steezy prime. To do this, you'll need to check whether every rotation of the number is a prime that satisfies the consecutive digits property mentioned above.

3. nthSteezyPrime [10 pts]
This function takes a non-negative integer number n, and returns the nth steezy prime.

2. carrylessAdd [35pts]
First, read the first page (page 44) from here about Carryless Arithmetic. Fun! Then, write the function carrylessAdd(x, y) that takes two non-negative integers x and y and returns their carryless sum. As the paper demonstrates, carrylessAdd(785, 376) returns 51.

3. vowelCount(s) [5pts]
Write the function vowelCount(s), that takes a string s, and returns the number of vowels in s, ignoring case, so "A" and "a" are both vowels. The vowels are "a", "e", "i", "o", and "u". So, for example: vowelCount("Abc def!!! a? yzyzyz!") returns 3 (two a's and one e).