This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A098550 #409 Jun 28 2025 11:15:59 %S A098550 1,2,3,4,9,8,15,14,5,6,25,12,35,16,7,10,21,20,27,22,39,11,13,33,26,45, %T A098550 28,51,32,17,18,85,24,55,34,65,36,91,30,49,38,63,19,42,95,44,57,40,69, %U A098550 50,23,48,115,52,75,46,81,56,87,62,29,31,58,93,64,99,68,77,54,119,60 %N A098550 The Yellowstone permutation: a(n) = n if n <= 3, otherwise the smallest number not occurring earlier having at least one common factor with a(n-2), but none with a(n-1). %C A098550 For n > 3, gcd(a(n), a(n-1)) = 1 and gcd(a(n), a(n-2)) > 1. (This is just a restatement of the definition.) %C A098550 This is now known to be a permutation of the natural numbers: see the 2015 article by Applegate, Havermann, Selcoe, Shevelev, Sloane, and Zumkeller. %C A098550 From _N. J. A. Sloane_, Nov 28 2014: (Start) %C A098550 Some of the known properties (but see the above-mentioned article for a fuller treatment): %C A098550 1. The sequence is infinite. Proof: We can always take a(n) = a(n-2)*p, where p is a prime that is larger than any prime dividing a(1), ..., a(n-1). QED %C A098550 2. At least one-third of the terms are composite. Proof: The sequence cannot contain three consecutive primes. So at least one term in three is composite. QED %C A098550 3. For any prime p, there is a term that is divisible by p. Proof: Suppose not. (i) No prime q > p can divide any term. For if a(n)=kq is the first multiple of q to appear, then we could have used kp < kq instead, a contradiction. So every term a(n) is a product of primes < p. (ii) Choose N such that a(n) > p^2 for all n > N. For n > N, let a(n)=bg, a(n+1)=c, a(n+2)=dg, where g=gcd(a(n),a(n+2)). Let q be the largest prime factor of g. We know q < p, so qp < p^2 < dg, so we could have used qp instead of dg, a contradiction. QED %C A098550 3a. Let a(n_p) be the first term that is divisible by p (this is A251541). Then a(n_p) = q*p where q is a prime less than p. If p < r are primes then n_p < n_r. Proof: Immediate consequences of the definition. %C A098550 4. (From _David Applegate_, Nov 27 2014) There are infinitely many even terms. Proof: %C A098550 Suppose not. Then let 2x be the maximum even entry. Because the sequence is infinite, there exists an N such that for any n > N, a(n) is odd, and a(n) > x^2. %C A098550 In addition, there must be some n > N such that a(n) < a(n+2). For that n, let g = gcd(a(n),a(n+2)), a(n) = bg, a(n+1)=c, a(n+2)=dg, with all of b,c,d,g relatively prime, and odd. %C A098550 Since dg > bg, d > b >= 1, so d >= 3. Also, g >= 3. %C A098550 Since a(n) = bg > x^2, one of b or g is > x. %C A098550 Case 1: b > x. Then 2b > 2x, so 2b has not yet occurred in the sequence. And gcd(bg,2b)=b > x > 1, gcd(2b,c)=1, and since g >= 3, 2b < bg < dg. So a(n+2) should have been 2b instead of dg. %C A098550 Case 2: g > x. Then 2g > 2x, so 2g has not yet occurred in the sequence. And gcd(bg,2g)=g > 1, gcd(2g,c)=1, and since d >= 3, 2g < dg. So a(n+2) should have been 2g instead of dg. %C A098550 In either case, we derive a contradiction. QED %C A098550 Conjectures: %C A098550 5. For any prime p > 97, the first time we see p, it is in the subsequence a(n) = 2b, a(n+2) = 2p, a(n+4) = p for some n, b, where n is about 2.14*p and gcd(b,p)=1. %C A098550 6. The value of |{k=1,..,n: a(k)<=k}|/n tends to 1/2. - _Jon Perry_, Nov 22 2014 [Comment edited by _N. J. A. Sloane_, Nov 23 2014 and Dec 26 2014] %C A098550 7. Based on the first 250000 terms, I conjectured on Nov 30 2014 that a(n)/n <= (Pi/2)*log n. %C A098550 8. The primes in the sequence appear in their natural order. This conjecture is very plausible but as yet there is no proof. - _N. J. A. Sloane_, Jan 29 2015 %C A098550 (End) %C A098550 The only fixed points seem to be {1, 2, 3, 4, 12, 50, 86} - see A251411. Checked up to n=10^4. - _L. Edson Jeffery_, Nov 30 2014. No further terms up to 10^5 - _M. F. Hasler_, Dec 01 2014; up to 250000 - _Reinhard Zumkeller_; up to 300000 (see graph) - _Hans Havermann_, Dec 01 2014; up to 10^6 - _Chai Wah Wu_, Dec 06 2014; up to 10^8 - _David Applegate_, Dec 08 2014. %C A098550 From _N. J. A. Sloane_, Dec 04 2014: (Start) %C A098550 The first 250000 points lie on about 8 roughly straight lines, whose slopes are approximately 0.467, 0.957, 1.15, 1.43, 2.40, 3.38, 5.25 and 6.20. %C A098550 The first six lines seem well-established, but the two lines with highest slope at present are rather sparse. Presumably as the number of points increases, there will be more and more lines of ever-increasing slopes. %C A098550 These lines can be seen in the Havermann link. See the "slopes" link for a list of the first 250000 terms sorted according to slope (the four columns in the table give n, a(n), the slope a(n)/n, and the number of divisors of a(n), respectively). %C A098550 The primes (with two divisors) all lie on the lowest line, and the lines of slopes 1.43 and higher essentially consist of the products of two primes (with four divisors). %C A098550 (End) %C A098550 The eight roughly straight lines mentioned above are actually curves. A good fit for the "line" with slope ~= 1.15 is a(n)~=n(1+1.0/log(n/24.2)), and a good fit for the other "lines" is a(n)~= (c/2)*n(1-0.5/log(n/3.67)), for c = 1,2,3,5,7,11,13. The first of these curves consists of most of the odd terms in the sequence. The second family consists of the primes (c=1), even terms (c=2), and c*prime (c=3,5,7,11,13,...). This functional form for the fit is motivated by the observed pattern (after the first 204 terms) of alternating even and odd terms, except for the sequence pattern 2*p, odd, p, even, q*p when reaching a prime (with q a prime < p). - _Jon E. Schoenfield_ and _David Applegate_, Dec 15 2014 %C A098550 For a generalization, see the sequence of monomials of primes in the comment in A247225. - _Vladimir Shevelev_, Jan 19 2015 %C A098550 From _Vladimir Shevelev_, Feb 24 2015: (Start) %C A098550 Let P be prime. Denote by S_P*P the first multiple of P appearing in the sequence. Then %C A098550 1) For P >= 5, S_P is prime. %C A098550 Indeed, let %C A098550 a(n-2)=v, a(n-1)=w, a(n)=S_P*P. (*) %C A098550 Note that gcd(v,P)=1. Therefore, by the definition of the sequence, S_P*P should be the smallest number such that gcd(v,S_P) > 1. %C A098550 So S_P is the smallest prime factor of v. %C A098550 2) The first multiples of all primes appear in the natural order. %C A098550 Suppose not. Then there is a pair of primes P < Q such that S_Q*Q appears earlier than S_P*P. Let %C A098550 a(m-2)=v_1, a(m-1)=w_1, a(m)=S_Q*Q. (**) %C A098550 Then, as in (*), S_Q is the smallest prime factor of v_1. But this does not depend on Q. So S_Q*P is a smaller candidate in (**), a contradiction. %C A098550 3) S_P < P. %C A098550 Indeed, from (*) it follows that the first multiple of S_P appears earlier than the first multiple of P. So, by 2), S_P < P. %C A098550 (End) %C A098550 For any given set S of primes, the subsequence consisting of numbers whose prime factors are exactly the primes in S appears in increasing order. For example, if S = {2,3}, 6 appears first, in due course followed by 12, 18, 24, 36, 48, 54, 72, etc. The smallest numbers in each subsequence (i.e., those that appear first) are the squarefree numbers A005117(n), n > 1. - _Bob Selcoe_, Mar 06 2015 %H A098550 Paul Tek, <a href="/A098550/b098550.txt">Table of n, a(n) for n = 1..10000</a> %H A098550 David Applegate, <a href="/A098550/a098550.cc.txt">C++ program for efficiently computing terms</a> %H A098550 David Applegate, <a href="/A098550/a098550_1.cc.txt">Revised C++ program with option to print more variables</a> %H A098550 David L. Applegate, Hans Havermann, Bob Selcoe, Vladimir Shevelev, N. J. A. Sloane, and Reinhard Zumkeller, <a href="https://arxiv.org/abs/1501.01669">The Yellowstone Permutation</a>, arXiv preprint arXiv:1501.01669 [math.NT], 2015. Also <a href="https://cs.uwaterloo.ca/journals/JIS/VOL18/Sloane/sloane9.html">Journal of Integer Sequences</a>, Vol. 18:6 (2015), Article 15.6.7 %H A098550 Brady Haran and N. J. A. Sloane, <a href="https://www.youtube.com/watch?v=DUaqiM1bGX4">The Yellowstone Permutation</a>, Numberphile video, Jan 29 2023. [At 4:07 when I say "we got twice 61" I should have said "we got about twice 61", and the image should show 120 rather than 122.- _N. J. A. Sloane_, Feb 02 2023] %H A098550 Hans Havermann, <a href="/A098550/a098550.png">Graph of first 300000 terms</a> (the red line is y=x) %H A098550 Hans Havermann, <a href="/A098550/a098550_2.txt">Loops and unresolved chains for map n -> A098550(n) trajectories</a> %H A098550 L. Edson Jeffery, <a href="/A098550/a098550.pdf">Log plot of first 2484 terms</a>. %H A098550 Dariel I. Ojera, <a href="https://doi.org/10.5281/zenodo.13993059">Unveiling the Properties and Relationship of Yellowstone Permutation Sequence</a>, Psych. Educ.: Multidisc. J. (2024) Vol. 27, No. 2, 173-184. %H A098550 Scott R. Shannon, <a href="/A098550/a098550_1.png">Graph of 250000 terms</a>, based on Reinhard Zumkeller data, plotted with colors indicating the least prime factor (lpf). Terms with an lpf of 2 are shown in white, terms with an lpf of 3,5,7,11,13,17,19 are shown as one of the seven rainbow colors from red to violet, and terms with an lpf >= 23 are shown in gray. %H A098550 N. J. A. Sloane, <a href="/A098550/a098550_1.txt">First 250000 terms sorted according to slope a(n)/n</a> %H A098550 N. J. A. Sloane, <a href="https://vimeo.com/457349959">Conant's Gasket, Recamán Variations, the Enots Wolley Sequence, and Stained Glass Windows</a>, Experimental Math Seminar, Rutgers University, Sep 10 2020 (video of Zoom talk) %H A098550 N. J. A. Sloane, <a href="https://arxiv.org/abs/2105.05111">The OEIS: A Fingerprint File for Mathematics</a>, arXiv:2105.05111 [math.HO], 2021. %H A098550 N. J. A. Sloane, <a href="https://arxiv.org/abs/2301.03149">"A Handbook of Integer Sequences" Fifty Years Later</a>, arXiv:2301.03149 [math.NT], 2023, p. 16. %H A098550 Reinhard Zumkeller, <a href="/A098550/a098550.txt">Table of n, a(n) for n = 1..250000</a> %H A098550 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %p A098550 N:= 10^4: # to get a(1) to a(n) where a(n+1) is the first term > N %p A098550 B:= Vector(N,datatype=integer[4]): %p A098550 for n from 1 to 3 do A[n]:= n: od: %p A098550 for n from 4 do %p A098550 for k from 4 to N do %p A098550 if B[k] = 0 and igcd(k,A[n-1]) = 1 and igcd(k,A[n-2]) > 1 then %p A098550 A[n]:= k; %p A098550 B[k]:= 1; %p A098550 break %p A098550 fi %p A098550 od: %p A098550 if k > N then break fi %p A098550 od: %p A098550 seq(A[i],i=1..n-1); # _Robert Israel_, Nov 21 2014 %t A098550 f[lst_List] := Block[{k = 4}, While[ GCD[ lst[[-2]], k] == 1 || GCD[ lst[[-1]], k] > 1 || MemberQ[lst, k], k++]; Append[lst, k]]; Nest[f, {1, 2, 3}, 68] (* _Robert G. Wilson v_, Nov 21 2014 *) %t A098550 NN = Range[4, 1000]; a098550 = {1, 2, 3}; g = {-1}; While[g[[1]] != 0, g = Flatten[{FirstPosition[NN, v_ /; GCD[a098550[[-1]], v] == 1 && GCD[a098550[[-2]], v] > 1, 0]}]; If[g[[1]] != 0, d = NN[[g]]; a098550 = Flatten[Append[a098550, d[[1]]]]; NN = Delete[NN, g[[1]]]]]; Table[a098550[[n]], {n, 71}] (* _L. Edson Jeffery_, Jan 01 2015 *) %o A098550 (Haskell) %o A098550 import Data.List (delete) %o A098550 a098550 n = a098550_list !! (n-1) %o A098550 a098550_list = 1 : 2 : 3 : f 2 3 [4..] where %o A098550 f u v ws = g ws where %o A098550 g (x:xs) = if gcd x u > 1 && gcd x v == 1 %o A098550 then x : f v x (delete x ws) else g xs %o A098550 -- _Reinhard Zumkeller_, Nov 21 2014 %o A098550 (PARI) a(n, show=1, a=3, o=2, u=[])={n<3&&return(n); show&&print1("1, 2"); for(i=4,n, show&&print1(","a); u=setunion(u, Set(a)); while(#u>1 && u[2]==u[1]+1, u=vecextract(u,"^1")); for(k=u[1]+1, 9e9, gcd(k,o)>1||next; setsearch(u,k)&&next; gcd(k,a)==1||next; o=a; a=k; break)); a} \\ Replace "show" by "a+1==i" in the main loop to print only fixed points. - _M. F. Hasler_, Dec 01 2014 %o A098550 (Python) %o A098550 from math import gcd %o A098550 A098550_list, l1, l2, s, b = [1,2,3], 3, 2, 4, {} %o A098550 for _ in range(1,10**6): %o A098550 i = s %o A098550 while True: %o A098550 if not i in b and gcd(i,l1) == 1 and gcd(i,l2) > 1: %o A098550 A098550_list.append(i) %o A098550 l2, l1, b[i] = l1, i, 1 %o A098550 while s in b: %o A098550 b.pop(s) %o A098550 s += 1 %o A098550 break %o A098550 i += 1 # _Chai Wah Wu_, Dec 04 2014 %Y A098550 Cf. A098548, A098551, A249943 (first time all 1..n appear), A251553. %Y A098550 The inverse permutation is in A098551. %Y A098550 A098552(n) = a(a(n)). %Y A098550 A251102(n) = GCD(a(n+2),a(n)). %Y A098550 Cf. A251101 (smallest prime factor), A251103 (largest prime factor), A251138 (number of distinct prime factors), A251140 (total number of prime factors), A251045 (squarefree part), A251089 (squarefree kernel), A250127 and A251415 (records for a(n)/n), A251411 (fixed points), A248647 (records). %Y A098550 Cf. also A251412 (trajectory of 11), A251556 (finite cycles), A251413 and A251414 (variant involving odd numbers), A249357 ("Fibonacci" variant). %Y A098550 Smallest missing numbers: A251416, A251417, A251546-A251552, A247253. See also A251557, A241558, A251559. %Y A098550 Indices of some pertinent subsequences: A251237 (even numbers), A251238 (odd numbers), A251391 (squarefree), A251541 and A251239 (primes), A251240 (squares of primes), A251241 (prime powers), A251393 (powers of 2), A251392 (nonprimes), A253297 (primes p for which some multiple k*p > 2*p precedes p). %Y A098550 Three arrays concerning the occurrences of multiples of primes: A251637, A251715, A251716. %Y A098550 Two sequences related to the numbers which immediately follow a prime: A253048, A253049. Seven sequences related to the numbers that appear two steps after primes: A251542, A251543, A251544, A251545, A253052, A253053, A253054. See also A253055 and A253056. %Y A098550 Other starting values: A251554, A251555. %Y A098550 See also A251756, A253297, A251662, A253572, A253573, A253591, A253593, A253588, A253590, A253609, A252865, A252867, A252868, A247225, A247942, A254003, A254077, A254669, A254670, A255509 (version with a priority for appearance of the primes), A255615, A255617, A256189, A256224, A256368, A256461. %Y A098550 See also A064413 (EKG sequence), A255582, A121216 (similar sequences), A257112 (two-dimensional analog). %Y A098550 See also A253765 and A253766 (bisections), A250299 (parity), A253768 (partial sums). %Y A098550 See A336957 for a variation. %K A098550 nonn,nice,hear %O A098550 1,2 %A A098550 _Reinhard Zumkeller_, Sep 14 2004