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).
Links
- Paul Tek, Table of n, a(n) for n = 1..10000
- David Applegate, C++ program for efficiently computing terms
- David Applegate, Revised C++ program with option to print more variables
- David L. Applegate, Hans Havermann, Bob Selcoe, Vladimir Shevelev, N. J. A. Sloane, and Reinhard Zumkeller, The Yellowstone Permutation, arXiv preprint arXiv:1501.01669 [math.NT], 2015. Also Journal of Integer Sequences, Vol. 18:6 (2015), Article 15.6.7
- Brady Haran and N. J. A. Sloane, The Yellowstone Permutation, 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]
- Hans Havermann, Graph of first 300000 terms (the red line is y=x)
- Hans Havermann, Loops and unresolved chains for map n -> A098550(n) trajectories
- L. Edson Jeffery, Log plot of first 2484 terms.
- Dariel I. Ojera, Unveiling the Properties and Relationship of Yellowstone Permutation Sequence, Psych. Educ.: Multidisc. J. (2024) Vol. 27, No. 2, 173-184.
- Scott R. Shannon, Graph of 250000 terms, 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.
- N. J. A. Sloane, First 250000 terms sorted according to slope a(n)/n
- N. J. A. Sloane, Conant's Gasket, Recamán Variations, the Enots Wolley Sequence, and Stained Glass Windows, Experimental Math Seminar, Rutgers University, Sep 10 2020 (video of Zoom talk)
- N. J. A. Sloane, The OEIS: A Fingerprint File for Mathematics, arXiv:2105.05111 [math.HO], 2021.
- N. J. A. Sloane, "A Handbook of Integer Sequences" Fifty Years Later, arXiv:2301.03149 [math.NT], 2023, p. 16.
- Reinhard Zumkeller, Table of n, a(n) for n = 1..250000
- Index entries for sequences that are permutations of the natural numbers
Crossrefs
Programs
-
Haskell
import Data.List (delete) a098550 n = a098550_list !! (n-1) a098550_list = 1 : 2 : 3 : f 2 3 [4..] where f u v ws = g ws where g (x:xs) = if gcd x u > 1 && gcd x v == 1 then x : f v x (delete x ws) else g xs -- Reinhard Zumkeller, Nov 21 2014
-
Maple
N:= 10^4: # to get a(1) to a(n) where a(n+1) is the first term > N B:= Vector(N,datatype=integer[4]): for n from 1 to 3 do A[n]:= n: od: for n from 4 do for k from 4 to N do if B[k] = 0 and igcd(k,A[n-1]) = 1 and igcd(k,A[n-2]) > 1 then A[n]:= k; B[k]:= 1; break fi od: if k > N then break fi od: seq(A[i],i=1..n-1); # Robert Israel, Nov 21 2014
-
Mathematica
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 *) 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 *)
-
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
-
Python
from math import gcd A098550_list, l1, l2, s, b = [1,2,3], 3, 2, 4, {} for _ in range(1,10**6): i = s while True: if not i in b and gcd(i,l1) == 1 and gcd(i,l2) > 1: A098550_list.append(i) l2, l1, b[i] = l1, i, 1 while s in b: b.pop(s) s += 1 break i += 1 # Chai Wah Wu, Dec 04 2014
Comments