39 lines
1.3 KiB
Plaintext
39 lines
1.3 KiB
Plaintext
The '''Yellowstone sequence''', also called the '''Yellowstone permutation''', is defined as:
|
|
|
|
For n <= 3,
|
|
|
|
a(n) = n
|
|
|
|
For n >= 4,
|
|
|
|
a(n) = the smallest number not already in sequence such that a(n) is relatively prime to a(n-1) and
|
|
is not relatively prime to a(n-2).
|
|
|
|
|
|
The sequence is a permutation of the natural numbers, and gets its name from what its authors felt was a spiking, geyser like appearance of a plot of the sequence.
|
|
|
|
|
|
;Example:
|
|
a(4) is 4 because 4 is the smallest number following 1, 2, 3 in the sequence that is relatively prime to the entry before it (3), and is not relatively prime to the number two entries before it (2).
|
|
|
|
|
|
;Task
|
|
: Find and show as output the first '''30''' Yellowstone numbers.
|
|
|
|
|
|
;Extra
|
|
: Demonstrate how to plot, with x = n and y coordinate a(n), the first 100 Yellowstone numbers.
|
|
|
|
|
|
;Related tasks:
|
|
:* [https://rosettacode.org/wiki/Greatest_common_divisor Greatest common divisor].
|
|
:* [https://rosettacode.org/wiki/Plot_coordinate_pairs Plot coordinate pairs].
|
|
:* [[EKG sequence convergence]]
|
|
|
|
|
|
;See also:
|
|
:* The OEIS entry: [https://oeis.org/A098550 A098550 The Yellowstone permutation].
|
|
:* Applegate et al, 2015: The Yellowstone Permutation [https://arxiv.org/abs/1501.01669].
|
|
<br><br>
|
|
|