A127202 a(1)=1, a(2)=2; a(n) = the smallest positive integer not occurring earlier in the sequence such that gcd(a(n), a(n-1)) does not equal gcd(a(n-1), a(n-2)).
1, 2, 4, 3, 6, 5, 10, 7, 14, 8, 9, 12, 11, 22, 13, 26, 15, 18, 16, 17, 34, 19, 38, 20, 21, 24, 23, 46, 25, 30, 27, 28, 32, 29, 58, 31, 62, 33, 36, 35, 40, 37, 74, 39, 42, 41, 82, 43, 86, 44, 45, 48, 47, 94, 49, 56, 50, 51, 54, 52, 53, 106, 55, 60, 57, 59, 118, 61, 122, 63, 66
Offset: 1
Keywords
Examples
gcd(a(7), a(8)) = gcd(10,7) = 1. So a(9) is the smallest positive integer which does not occur earlier in the sequence and which is such that gcd(a(9), 7) is not 1. So a(9) = 14, since gcd(14,7) = 7.
Links
- N. J. A. Sloane, Table of n, a(n) for n = 1..75000 (First 10000 terms from Rémy Sigrist)
- Dana G. Korssjoen, Biyao Li, Stefan Steinerberger, Raghavendra Tripathi, and Ruimin Zhang, Finding structure in sequences of real numbers via graph theory: a problem list, arXiv:2012.04625, Dec 08, 2020
- N. J. A. Sloane, Proof that A127202 is a permutation.
Crossrefs
Programs
-
Mathematica
f[l_List] := Block[{k = 1, c = GCD[l[[ -1]], l[[ -2]]]},While[MemberQ[l, k] || GCD[k, l[[ -1]]] == c, k++ ];Append[l, k]];Nest[f, {1, 2}, 69] (* Ray Chandler, Jan 16 2007 *)
-
PARI
\\ based on Rémy Sigrist's program for A280985 { seen = 0; p = 1; g = 2; for (n=1, 10000, a = 1; while (bittest(seen, a) || (n>2 && gcd(p,a)==g), a++; ); print (n " " a); g = gcd(p,a); p = a; seen += 2^a; ) }
Extensions
Extended by Ray Chandler, Jan 16 2007
Comments