Jump to content

Kolakoski sequence: Difference between revisions

m
fmt, series-> sequence
m (fmt.)
m (fmt, series-> sequence)
Line 1:
{{draft task}}
The [[wp:Kolakoski sequence|Kolakoski sequence]] is an infinite sequence of [[wp:Natural number|natural numbers]], (excluding zero); with the property that:
: ''if you form a new sequence from the counts of runs of the same number in the first seriessequence, this new sequence is the same as the first seriessequence''.
 
;Example:
Line 17:
;Creating a Kolakoski sequence:
 
letsLets start with the two numbers <code>(1, 2)</code> that we will cycle through; i.e. they will be used in this order:<br> <code>1,2,1,2,1,2,....</code>
 
# We start the sequence <code>s</code> with the first item from the cycle <code>c</code>:<br> <code>1</code>
Line 27:
<ol start="3">
<li><p>Increment <code>k</code></p></li>
<li><p>Get the next item from <code>c</code> and append it to the end of seriessequence <code>s</code>. <code>s</code> will then become:<br> <code>1, 2</code></p></li>
<li><p><code>k</code> was moved to the second item in the list and <code>s[k]</code> states that it should appear two times, so append another of the last item to the seriessequence <code>s</code>:<br> <code>1, 2,2</code></p></li>
<li><p>Increment <code>k</code></p></li>
<li><p>Append the next item from the cycle to the list:<br> <code>1, 2,2, 1</code></p></li>
<li><p><code>k</code> is now at the third item in the list that states that the last item should appear twice so add another copy of the last item to the seriessequence <code>s</code>:<br> <code>1, 2,2, 1,1</code></p></li>
<li><p>increment k</p></li></ol>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.