<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Le 15/08/2021 à 09:00, Lester Anderson
a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:CAE3taFCapTt8o2NB900N0xS0sZuO51fG-hZhPt8YBvQMQ4iJ-Q@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<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>
</blockquote>
<p><br>
This runs all the 8 iterations, but each next iteration overwrites
ns and seq.<br>
What are the sizes of ns and seq ?<br>
</p>
<br>
</body>
</html>