Write a function called circularprimes that finds the


If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4+ 4 = 19 letters used in total. Write a function called number2letters that returns the number of letters needed to write down the number n in words. For example, 342 (three hundred forty two) contains 20 letters.

Notice that we do not count spaces, nor do we use hyphens. The only input to the function is n, a positive integer smaller than 1000, but you do not need to check this. (Inspired by Project Euler.)

Write a function called circular_primes that finds the number of circular prime numbers smaller than n, where n is a positive integer scalar input argument.

For example, the number, 197, is a circular prime because all rotations of its digits: 197, 971, and 719, are themselves prime.

For instance, there are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. It is important to emphasize that rotation means circular permutation not all possible permutations.

Solution Preview :

Prepared by a verified Expert
Computer Engineering: Write a function called circularprimes that finds the
Reference No:- TGS02877935

Now Priced at $20 (50% Discount)

Recommended (93%)

Rated (4.5/5)