CS 117 Assignment, Due 8:30 AM 1/31/96

You may work with a partner on this assignment. Hand in using HSP.

For this assignment, choose one of the following problems and write a Pascal program to solve it. In the comment at the top of your program, answer the question(s) posed in the problem you solved.

  1. A prime number is a positive integer greater than 1 (1 is not prime) whose only factors are 1 and the number itself. What are the 100th, 500th, and 1000th prime numbers?
  2. A palindrome is a word or phrase that reads the same backwards as forwards (not counting capitalization and punctuation). For example, "Hannah" and "Sit on a potato pan, Otis" are palindromes. What palindromic words are contained in the dictionary file /usr/dict/words? (No need to report that "a", "b", "c", etc. are palindromes.)
  3. Among the words in /usr/dict/words, what word contains the most vowels? The most consonants? The highest vowel-to-consonant ratio (not counting the words with no consonants)? (By vowel-to-consonant ratio, I mean the number of vowels divided by the number of consonants. For example, "lemur" has a VTCR of 2/3.)
  4. A perfect number is a positive integer, the sum of whose factors (not including the number) equals the number itself. For example, the factors of 28 are 1, 2, 4, 7, and 14, and 1 + 2 + 4 + 7 + 14 = 28, so 28 is perfect. What numbers between 1 and 10000 are perfect?




Jeff Ondich, Department of Mathematics and Computer Science, Carleton College, Northfield, MN 55057
(507) 663-4364, jondich@carleton.edu