login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A251554
a(1)=1, a(2)=2, a(3)=5; thereafter a(n) is the smallest number not occurring earlier having at least one common factor with a(n-2), but none with a(n-1).
3
1, 2, 5, 4, 15, 8, 3, 10, 9, 14, 27, 7, 6, 35, 12, 25, 16, 45, 22, 21, 11, 18, 55, 24, 65, 28, 13, 20, 39, 32, 33, 26, 51, 38, 17, 19, 34, 57, 40, 63, 44, 49, 30, 77, 36, 91, 46, 105, 23, 42, 115, 48, 85, 52, 75, 56, 69, 50, 81, 58, 93, 29, 31, 87, 62, 99, 64, 111
OFFSET
1,2
COMMENTS
A variant of A098550. See that entry for much more information.
It seems likely that this sequence will never merge with A098550, but it would be nice to have a proof.
LINKS
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 and J. Int. Seq. 18 (2015) 15.6.7.
MATHEMATICA
a251554[lst_List] :=
Block[{k = 3},
While[GCD[lst[[-2]], k] == 1 || GCD[lst[[-1]], k] > 1 ||
MemberQ[lst, k], k++]; Append[lst, k]]; Nest[a251554, {1, 2,
5}, 120] (* Michael De Vlieger, Dec 23 2014, after Robert G. Wilson v at A098550 *)
PROG
(Python)
from fractions import gcd
A251554_list, l1, l2, s, b = [1, 2, 5], 5, 2, 3, {5}
for _ in range(10**4):
....i = s
....while True:
........if not i in b and gcd(i, l1) == 1 and gcd(i, l2) > 1:
............A251554_list.append(i)
............l2, l1 = l1, i
............b.add(i)
............while s in b:
................b.remove(s)
................s += 1
............break
........i += 1 # Chai Wah Wu, Dec 21 2014
(Haskell)
import Data.List (delete)
a251554 n = a251554_list !! (n-1)
a251554_list = 1 : 2 : 5 : f 2 5 (3 : 4 : [6..]) 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, Dec 26 2014
CROSSREFS
Sequence in context: A079053 A224272 A189942 * A002518 A093727 A286146
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Dec 21 2014
STATUS
approved