% -*- latex -*-
% FILE: "/home/evmik/jobs/wm/2011_fall_practical_computing_for_scientists/hw09/hw09.tex"
% LAST MODIFICATION: "Sun, 20 Nov 2011 23:51:52 -0500 (evmik)"
% (C) 2010 by Eugeniy Mikhailov, <evgmik@gmail.com>
% $Id:$
\documentclass[letter,12pt]{article}

%---------------------------------------------------------------
\usepackage{listings}
\usepackage{color}
\usepackage{fullpage}
%---------------------------------------------------------------

\begin{document}
\newcommand{\problem}[1]{%
	{\flushleft  \bf #1\\}
}
\newcommand{\hw}[1]{%
	\begin{center}
		\Large  \bf Homework #1%
	\end{center}%
}
\newcommand{\mat}[1]{% matlab code
{\color{blue}\texttt{#1}}%
}

%---------------------------------------------------------------
\hw{09}

This homework is {\bf optional}. In case of completion the points will be
added to the total of all homeworks.

General comments: 
\begin{itemize}
	\item Do not forget to run some test cases. 
\end{itemize}


\problem{Problem 1 (10 points max)}
%---------------------------------------------------------------
The prime number is the integer which is divisible only  by 1 and itself.
We exclude 1 from the prime numbers list.

Write a function ``primes'' according to the following specification
\begin{lstlisting} [language=matlab]
function PrimeNumbersList = primes(N)
\end{lstlisting}
which outputs a {\bf row} vector of all prime numbers starting from 2 till N
(inclusive). N is guaranteed to be positive integer number, no checks 
for this are necessary.  Make sure your function follows the specification
above {\bf exactly}.

Example: primes(7) as well as primes(8) will result:
\begin{lstlisting} [language=matlab]
>> primes(8);
ans=[2, 3, 5, 7]
\end{lstlisting}

$N$ will be a large number something like $10^6$ or even more,
in speed comparison test cases.

\begin{itemize}
	\item 
		If you do the function right you will get only 2 points.
	\item 
		You will get 5 points if your algorithm is the fastest in the class.
	\item 
		You will get 10 points if your algorithm is faster than instructor one.
	\item 
		We will run the competition during the practice section.
\end{itemize}



%---------------------------------------------------------------
\end{document}
%---------------------------------------------------------------
