Practice problems for the week of Feb 14
Note: This is a set of problems that will help you in preparing for the lab next week. However, the lab assignment are not going to be identical to these problems.
- Write a procedure that takes an integer n and returns the number of digits in n. Use only commands covered in class.
- Write a procedure that takes in integers n and i and returns the ith
least significant digit of n.
- Apply the seq() command and the previous procedures to make a set of the digits used in an integer.
- Use set minus to compute what digits do not appear in an integer.
- Write a procedure that takes as input an integer n and returns all
integers in 1..n that are not factorials. E.g. in the range 1..10, 1, 2, 6 are factorials (equal to 1!,2!,3! respectively).