<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:NimbusRomNo9L-Regu;}
@font-face
        {font-family:CMMI10;}
@font-face
        {font-family:CMR10;}
@font-face
        {font-family:CMSY10;}
@font-face
        {font-family:NimbusMonL-Regu;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-US;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-US;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-AU" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">The program you have is slightly different in its intentions &#8211; it asks for a number
<i>n</i> and then generates the first <i>n</i> prime numbers.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">However it could be adapted fairly easily by modifying the exit condition for the loop. (i.e. the program would ask for the last number and then check if Num=n to exit MainLoop. The Ender section would print
 Array.GetItemCount(Prime)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I&#8217;ve added some comments to the program to hopefully explain how it works.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Disclaimer: I don&#8217;t teach SD, and don&#8217;t really know Small Basic &#8211; I did a fair bit of programming in another life and still enjoy the occasional dabble.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Peter<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;mso-fareast-language:EN-AU">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;mso-fareast-language:EN-AU"> sofdev-bounces@edulists.com.au
 [mailto:sofdev-bounces@edulists.com.au] <b>On Behalf Of </b>Victoria Farrell<br>
<b>Sent:</b> Tuesday, 29 April 2014 8:27 AM<br>
<b>To:</b> Year 12 Software Development Teachers' Mailing List<br>
<b>Subject:</b> [Year 12 SofDev] Programming Help<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Very new to Software Development and it&#8217;s been 20 odd years since programming at Uni, I could use some help with a problem.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I recently had students involved in the Melbourne University Programming Competition and had problems with solving the following question:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">A positive integer
</span><span style="font-family:CMMI10;mso-fareast-language:EN-AU">x &gt; </span><span style="font-family:CMR10;mso-fareast-language:EN-AU">1
</span><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">is a prime if its only factors are
</span><span style="font-family:CMR10;mso-fareast-language:EN-AU">1 </span><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">and
</span><span style="font-family:CMMI10;mso-fareast-language:EN-AU">x</span><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">. Hence the numbers
</span><span style="font-family:CMR10;mso-fareast-language:EN-AU">2</span><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">,
</span><span style="font-family:CMR10;mso-fareast-language:EN-AU">11</span><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">, and
</span><span style="font-family:CMR10;mso-fareast-language:EN-AU">101 </span><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">are primes, but
</span><span style="font-family:CMR10;mso-fareast-language:EN-AU">1</span><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">,
</span><span style="font-family:CMR10;mso-fareast-language:EN-AU">9</span><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">and
</span><span style="font-family:CMR10;mso-fareast-language:EN-AU">1001 </span><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">are not prime*.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">The input to your program is a single positive integer
</span><span style="font-family:CMMI10;mso-fareast-language:EN-AU">n</span><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">. The output should be the number of primes that are
</span><span style="font-family:CMSY10;mso-fareast-language:EN-AU">_ </span><span style="font-family:CMMI10;mso-fareast-language:EN-AU">n</span><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">For example, if the input is
</span><span style="font-family:NimbusMonL-Regu;mso-fareast-language:EN-AU">1000 </span>
<span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">then the output is
</span><span style="font-family:NimbusMonL-Regu;mso-fareast-language:EN-AU">168</span><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">* In case you&#8217;re wondering,
</span><span style="font-family:CMR10;mso-fareast-language:EN-AU">1001 = 7 </span>
<span style="font-family:CMSY10;mso-fareast-language:EN-AU">_ </span><span style="font-family:CMR10;mso-fareast-language:EN-AU">11
</span><span style="font-family:CMSY10;mso-fareast-language:EN-AU">_ </span><span style="font-family:CMR10;mso-fareast-language:EN-AU">13</span><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">Your five answers should be for<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">1.
</span><span style="font-family:CMMI10;mso-fareast-language:EN-AU">n </span><span style="font-family:CMR10;mso-fareast-language:EN-AU">= 10<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">2.
</span><span style="font-family:CMMI10;mso-fareast-language:EN-AU">n </span><span style="font-family:CMR10;mso-fareast-language:EN-AU">= 100<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">3.
</span><span style="font-family:CMMI10;mso-fareast-language:EN-AU">n </span><span style="font-family:CMR10;mso-fareast-language:EN-AU">= 100</span><span style="font-family:CMMI10;mso-fareast-language:EN-AU">;
</span><span style="font-family:CMR10;mso-fareast-language:EN-AU">000<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">4.
</span><span style="font-family:CMMI10;mso-fareast-language:EN-AU">n </span><span style="font-family:CMR10;mso-fareast-language:EN-AU">= 10</span><span style="font-family:CMMI10;mso-fareast-language:EN-AU">;
</span><span style="font-family:CMR10;mso-fareast-language:EN-AU">000</span><span style="font-family:CMMI10;mso-fareast-language:EN-AU">;
</span><span style="font-family:CMR10;mso-fareast-language:EN-AU">000<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU">5.
</span><span style="font-family:CMMI10;mso-fareast-language:EN-AU">n </span><span style="font-family:CMR10;mso-fareast-language:EN-AU">= 20</span><span style="font-family:CMMI10;mso-fareast-language:EN-AU">;
</span><span style="font-family:CMR10;mso-fareast-language:EN-AU">000</span><span style="font-family:CMMI10;mso-fareast-language:EN-AU">;
</span><span style="font-family:CMR10;mso-fareast-language:EN-AU">000<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-family:NimbusRomNo9L-Regu;mso-fareast-language:EN-AU"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">We decided to solve in Small Basic so as to get a handle on lops and arrays, but did not manage to solve it. I found a solution online (below) but was not able to understand how the array worked. It doesn&#8217;t solve
 the problem exactly as it just lists the input number of primes, but it certain can calculate/select for primes.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;color:black;mso-fareast-language:EN-AU">Init</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">:</span><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;color:#006060;mso-fareast-language:EN-AU">TextWindow</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">.</span><span style="font-size:12.0pt;font-family:Consolas;color:#802020;mso-fareast-language:EN-AU">WriteLine</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">(</span><span style="font-size:12.0pt;font-family:Consolas;color:#CC6633;mso-fareast-language:EN-AU">&quot;How
 many Prime numbers (1-1000)? &quot;</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">)</span><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;color:black;mso-fareast-language:EN-AU">N</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">=</span><span style="font-size:12.0pt;font-family:Consolas;color:#006060;mso-fareast-language:EN-AU">TextWindow</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">.</span><span style="font-size:12.0pt;font-family:Consolas;color:#802020;mso-fareast-language:EN-AU">ReadNumber</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">()</span><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:12.0pt;font-family:Consolas;color:#7777FF;mso-fareast-language:EN-AU">If</span></b><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">
<span style="color:black">N</span><span style="color:maroon">&lt;</span><span style="color:#DD6633">1</span>
<span style="color:maroon">Or</span> <span style="color:black">N</span><span style="color:maroon">&gt;</span><span style="color:#DD6633">1000</span>
<b><span style="color:#7777FF">Then</span></b><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;
<span style="color:#006060">TextWindow</span><span style="color:maroon">.</span><span style="color:#802020">WriteLine</span><span style="color:maroon">(</span><span style="color:#CC6633">&quot;That's All Folks!&quot;</span><span style="color:maroon">)</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;
<span style="color:#006060">TextWindow</span><span style="color:maroon">.</span><span style="color:#802020">Pause</span><span style="color:maroon">()</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;
<span style="color:#006060">Program</span><span style="color:maroon">.</span><span style="color:#802020">End</span><span style="color:maroon">()</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:12.0pt;font-family:Consolas;color:#7777FF;mso-fareast-language:EN-AU">EndIf</span></b><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;color:black;mso-fareast-language:EN-AU">Prime</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">=</span><span style="font-size:12.0pt;font-family:Consolas;color:#CC6633;mso-fareast-language:EN-AU">&quot;1=2;&quot;</span><span style="font-size:12.0pt;font-family:Consolas;color:#1F497D;mso-fareast-language:EN-AU">&nbsp;
 &#8216; Prime is an array to hold the prime numbers we find. Start by creating a single element array with value 2 &#8211; the first prime number</span><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;color:black;mso-fareast-language:EN-AU">Num</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">=</span><span style="font-size:12.0pt;font-family:Consolas;color:black;mso-fareast-language:EN-AU">Prime[</span><span style="font-size:12.0pt;font-family:Consolas;color:#006060;mso-fareast-language:EN-AU">Array</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">.</span><span style="font-size:12.0pt;font-family:Consolas;color:#802020;mso-fareast-language:EN-AU">GetItemCount</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">(</span><span style="font-size:12.0pt;font-family:Consolas;color:black;mso-fareast-language:EN-AU">Prime</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">)</span><span style="font-size:12.0pt;font-family:Consolas;color:black;mso-fareast-language:EN-AU">]</span><span style="font-size:12.0pt;font-family:Consolas;color:#1F497D;mso-fareast-language:EN-AU">
 &#8216; Num is the current number we are checking to see if it is prime. This gets the value of the last element in Prime. Could have also said Num=2</span><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;color:black;mso-fareast-language:EN-AU">MainLoop</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">:</span><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;color:black;mso-fareast-language:EN-AU">Num</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">=</span><span style="font-size:12.0pt;font-family:Consolas;color:black;mso-fareast-language:EN-AU">Num</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">&#43;</span><span style="font-size:12.0pt;font-family:Consolas;color:#DD6633;mso-fareast-language:EN-AU">1</span><span style="font-size:12.0pt;font-family:Consolas;color:#1F497D;mso-fareast-language:EN-AU">
 &#8216; looking at the next number to see if it is prime</span><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;&nbsp;<span style="color:black">Flag</span><span style="color:maroon">=</span><span style="color:#DD6633">1</span><span style="color:#1F497D">
 &#8216; Flag is 1 if Num is prime</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="color:#1F497D;mso-fareast-language:EN-AU"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;
<b><span style="color:#7777FF">For</span></b> <span style="color:black">i</span><span style="color:maroon">=</span><span style="color:#DD6633">1</span>
<b><span style="color:#7777FF">To</span></b> <span style="color:#006060">Array</span><span style="color:maroon">.</span><span style="color:#802020">GetItemCount</span><span style="color:maroon">(</span><span style="color:black">Prime</span><span style="color:maroon">)</span><span style="color:#1F497D">&nbsp;
</span></span><span style="color:#1F497D;mso-fareast-language:EN-AU">&#8216; Loop through each of the prime numbers in the array so far,</span><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;&nbsp;&nbsp;
<b><span style="color:#7777FF">If</span></b> <span style="color:maroon">(</span><span style="color:#006060">Math</span><span style="color:maroon">.</span><span style="color:#802020">Remainder</span><span style="color:maroon">(</span><span style="color:black">Num</span><span style="color:maroon">,</span><span style="color:black">Prime[i]</span><span style="color:maroon">)=</span><span style="color:#DD6633">0</span><span style="color:maroon">)</span>
<b><span style="color:#7777FF">Then</span><span style="color:#1F497D">&nbsp; </span></b><span style="color:#1F497D">&#8216; check if<b>
</b>the prime number is a factor of Num</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i><span style="color:#008020">'Not Prime</span></i><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:black">Flag</span><span style="color:maroon">=</span><span style="color:#DD6633">0</span><span style="color:#1F497D"> &#8216; resets Flag</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color:black">i</span><span style="color:maroon">=</span><span style="color:#006060">Array</span><span style="color:maroon">.</span><span style="color:#802020">GetItemCount</span><span style="color:maroon">(</span><span style="color:black">Prime</span><span style="color:maroon">)</span><span style="color:#1F497D">
 &#8216; sets i to the last value so it exits this loop</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;&nbsp;&nbsp;
<b><span style="color:#7777FF">EndIf</span></b><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;
<b><span style="color:#7777FF">EndFor</span></b><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;
<b><span style="color:#7777FF">If</span></b> <span style="color:black">Flag</span><span style="color:maroon">=</span><span style="color:#DD6633">1</span>
<b><span style="color:#7777FF">Then</span><span style="color:#1F497D"> &#8216;</span></b><span style="color:#1F497D">if we get to here with Flag=1 then the number has no factors besides itself &#8211; so it is prime</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;&nbsp;&nbsp;
<span style="color:black">Prime[</span><span style="color:#006060">Array</span><span style="color:maroon">.</span><span style="color:#802020">GetItemCount</span><span style="color:maroon">(</span><span style="color:black">Prime</span><span style="color:maroon">)&#43;</span><span style="color:#DD6633">1</span><span style="color:black">]</span><span style="color:maroon">=</span><span style="color:black">Num</span><span style="color:#1F497D">&nbsp;
 &#8216;add this number to the end of the Prime array</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;&nbsp;&nbsp;
<span style="color:#006060">TextWindow</span><span style="color:maroon">.</span><span style="color:#802020">Write</span><span style="color:maroon">(</span><span style="color:#006060">Array</span><span style="color:maroon">.</span><span style="color:#802020">GetItemCount</span><span style="color:maroon">(</span><span style="color:black">Prime</span><span style="color:maroon">))</span><span style="color:#1F497D">&nbsp;
 &#8216;print something out</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;&nbsp;&nbsp;
<span style="color:#006060">TextWindow</span><span style="color:maroon">.</span><span style="color:#802020">WriteLine</span><span style="color:maroon">(</span><span style="color:#CC6633">&quot;&nbsp;&nbsp; &quot;</span><span style="color:maroon">&#43;</span><span style="color:black">Num</span><span style="color:maroon">)</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;&nbsp;&nbsp;
<b><span style="color:#7777FF">if</span></b> <span style="color:#006060">Array</span><span style="color:maroon">.</span><span style="color:#802020">GetItemCount</span><span style="color:maroon">(</span><span style="color:black">Prime</span><span style="color:maroon">)&gt;=</span><span style="color:black">N</span>
<b><span style="color:#7777FF">Then</span><span style="color:#1F497D">&nbsp; </span></b><span style="color:#1F497D">&#8216;If we have found the number of primes requested, then exit the MainLoop<o:p></o:p></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b><span style="color:#7777FF">Goto</span></b> <span style="color:black">Ender</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;&nbsp;&nbsp;
<b><span style="color:#7777FF">EndIf</span></b><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;
<b><span style="color:#7777FF">EndIf</span></b><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;
<b><span style="color:#7777FF">Goto</span></b> <span style="color:black">MainLoop</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">&nbsp;
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;color:black;mso-fareast-language:EN-AU">Ender</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">:</span><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><i><span style="font-size:12.0pt;font-family:Consolas;color:#008020;mso-fareast-language:EN-AU">'TextWindow.Write(&quot;Press any key to continue...&quot;)</span></i><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;color:#006060;mso-fareast-language:EN-AU">TextWindow</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">.</span><span style="font-size:12.0pt;font-family:Consolas;color:#802020;mso-fareast-language:EN-AU">WriteLine</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">(</span><span style="font-size:12.0pt;font-family:Consolas;color:#CC6633;mso-fareast-language:EN-AU">&quot;---&quot;</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">)</span><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:12.0pt;font-family:Consolas;color:#006060;mso-fareast-language:EN-AU">TextWindow</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">.</span><span style="font-size:12.0pt;font-family:Consolas;color:#802020;mso-fareast-language:EN-AU">Pause</span><span style="font-size:12.0pt;font-family:Consolas;color:maroon;mso-fareast-language:EN-AU">()</span><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU"><o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:12.0pt;font-family:Consolas;color:#7777FF;mso-fareast-language:EN-AU">Goto</span></b><span style="font-size:12.0pt;font-family:Consolas;mso-fareast-language:EN-AU">
<span style="color:black">Init<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:Consolas;color:black;mso-fareast-language:EN-AU"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Can anyone &nbsp;give me a brief written description, or point me to an online resource that can explain how this array functions? Can anyone identify a Small Basic function more suited to this problem?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Vic<o:p></o:p></span></p>
</div>
<p></p><p><b>Important - </b>This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments check them for viruses and defects. Regardless of any loss, damage or consequence, whether caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender, and not necessarily those of the Department of Education and Early Childhood Development.</p>
</body>
</html>