Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: print prime
Date: Thu, 1 Oct 2009 14:30:21 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 26
Message-ID: <ha2edt$1v5$1@fred.mathworks.com>
References: <h9fob7$hs7$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1254407421 2021 172.30.248.38 (1 Oct 2009 14:30:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 1 Oct 2009 14:30:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:574241


"John Wong" <gokoproject@gmail.com> wrote in message <h9fob7$hs7$1@fred.mathworks.com>...
> I wrote a program, but this is so buggy I guess?
> I have this P4 2.6Ghz pc & 1GB Ram, I guess it's running out of memory or something. 
> 
> Some numbers it will print not a prime / is a prime.
> 
> Let say primeTest(1)
> it will say it's a prime
> 
> but when you do like primeTest(10)
> nothing shows instead, on the bottom of the matlab (where the start menu is located), it will say "busy". 
> 
> is there something i misunderstood my own program?
> 
> 
> function primeTest(x)
> n = 3;
> R=rem(x,n);
> while R ~= 0 & n < sqrt(x) & n < 10
>     n+2;

should read

     n=n+2;

us