
LINKS

Table of n, a(n) for n=1..7.
Hans Havermann, Loops and unresolved chains for map n > A098550(n) trajectories
David L. Applegate, Hans Havermann, Bob Selcoe, Vladimir Shevelev, N. J. A. Sloane, and Reinhard Zumkeller, The Yellowstone Permutation, arXiv preprint arXiv:1501.01669, 2015.


PROG

(Python)
from fractions import gcd
A251411_list, l1, l2, s, b = [1, 2, 3], 3, 2, 4, {}
for n in range(4, 10**4):
....i = s
....while True:
........if not i in b and gcd(i, l1) == 1 and gcd(i, l2) > 1:
............l2, l1, b[i] = l1, i, 1
............while s in b:
................b.pop(s)
................s += 1
............if i == n:
................A251411_list.append(n)
............break
........i += 1 # Chai Wah Wu, Dec 03 2014
