RosettaCodeData/Task/EKG-sequence-convergence/00-TASK.txt

36 lines
2.0 KiB
Plaintext

The sequence is from the natural numbers and is defined by:
* <code>a(1) = 1</code>;
* <code>a(2) = Start = 2</code>;
* for n > 2, <code>a(n)</code> shares at least one prime factor with <code>a(n-1)</code> and is the ''smallest'' such natural number ''not already used''.
<br>The sequence is called the [http://oeis.org/A064740 EKG sequence] (after its visual similarity to an electrocardiogram when graphed).
Variants of the sequence can be generated starting 1, N where N is any natural number larger than one. For the purposes of this task let us call:
* The sequence described above , starting <code>1, 2, ...</code> the <code>EKG(2)</code> sequence;
* the sequence starting <code>1, 3, ...</code> the <code>EKG(3)</code> sequence;
* ... the sequence starting <code>1, N, ...</code> the <code>EKG(N)</code> sequence.
;Convergence
If an algorithm that keeps track of the minimum amount of numbers and their corresponding prime factors used to generate the next term is used, then this may be known as the generators essential '''state'''. Two EKG generators with differing starts can converge to produce the same sequence after initial differences.<br>
<code>EKG(N1)</code> and <code>EKG(N2)</code> are said to to have converged at and after generation <code>a(c)</code> if <code>state_of(EKG(N1).a(c)) == state_of(EKG(N2).a(c))</code>.
;Task:
# Calculate and show here the first 10 members of <code>EKG(2)</code>.
# Calculate and show here the first 10 members of <code>EKG(5)</code>.
# Calculate and show here the first 10 members of <code>EKG(7)</code>.
# Calculate and show here the first 10 members of <code>EKG(9)</code>.
# Calculate and show here the first 10 members of <code>EKG(10)</code>.
# Calculate and show here at which term <code>EKG(5)</code> and <code>EKG(7)</code> converge &nbsp; ('''stretch goal''').
;Related Tasks:
# [[Greatest common divisor]]
# [[Sieve of Eratosthenes]]
# [[Yellowstone sequence]]
<br>
;Reference:
* [https://www.youtube.com/watch?v=yd2jr30K2R4 The EKG Sequence and the Tree of Numbers]. (Video).
<br><br>