primeSpace - The vector must be the specified length. % %...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% 9/21/2009 11:05 PM % Function Name: primeSpace % Inputs: % 1. double - starting number % 2. double - desired vector length % % Output: % 1. vector - vector of primes % % Function Description: % Write a function that takes in a starting number and a length. % Starting with the given number, use a while loop to construct a vector % that only contains primes.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The vector must be the specified length. % % The isprime() function returns true if the number you give it is prime. % function primes = primeSpace(start, len) primes = ; temp = start; while length(primes) < len if isprime(temp) primes(end + 1) = temp; end temp = temp + 1; end end...
View Full Document

This note was uploaded on 10/22/2009 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Institute of Technology.

Ask a homework question - tutors are online