<div dir="ltr">Hello,<div><br></div><div>Basic query. I have a simple code that applies the Collatz conjecture equation (3n+1) by running a function and then runs a loop over the values stored in prime (the first 8 Prime numbers):</div><div><br></div><div><span style="color:rgb(50,185,185);font-family:Monospaced">clear</span><br></div><div><pre style="font-family:Monospaced"><span style="color:rgb(50,185,185)">exec</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(188,143,143)">collatz.sci</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(92,92,92)">-</span><span style="color:rgb(188,143,143)">1</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(0,0,0)">prime</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(174,92,176);text-decoration-line:underline">primes</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(188,143,143)">20</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">; </span>
<span style="color:rgb(160,32,240)">for</span> <span style="color:rgb(0,0,0)">i</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(188,143,143)">1</span><span style="color:rgb(255,170,0)">:</span><span style="color:rgb(50,185,185)">length</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">prime</span><span style="color:rgb(74,85,219)">)</span>
<span style="color:rgb(74,85,219)">[</span><span style="color:rgb(0,0,0)">ns</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(0,0,0)">seq</span><span style="color:rgb(74,85,219)">]</span><span style="color:rgb(92,92,92)">=</span><span style="color:rgb(0,0,0)">collatz</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">prime</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(74,85,219)">)</span>
<span style="color:rgb(160,32,240)">end</span></pre>As it stands, this just runs to the end (i=8) and the value 19. How can I get the code to write the results of each loop pass into the variables ns and seq, such that each contains the results of the 8 passes?</div><div><br></div><div>Can no longer search the forums online from the website.</div><div><br></div><div>Thanks<br>Lester</div></div>