cp's OEIS Frontend

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.

A251555 a(1)=1, a(2)=3, a(3)=2; 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).

This page as a plain text file.
%I A251555 #31 Jan 26 2025 09:11:58
%S A251555 1,3,2,9,4,15,8,5,6,25,12,35,16,7,10,21,20,27,14,33,26,11,13,22,39,28,
%T A251555 45,32,51,38,17,18,85,24,55,34,65,36,91,30,49,40,63,44,57,46,19,23,76,
%U A251555 69,50,81,52,75,56,87,62,29,31,58,93,64,99,68,77,48,119,54
%N A251555 a(1)=1, a(2)=3, a(3)=2; 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).
%C A251555 A variant of A098550. See that entry for much more information.
%C A251555 It seems likely that this sequence will never merge with A098550, but it would be nice to have a proof.
%C A251555 A252912 gives numbers m, such that a(m) = A098550(m), see also A252939 and A252940. - _Reinhard Zumkeller_, Dec 25 2014
%H A251555 Chai Wah Wu, <a href="/A251555/b251555.txt">Table of n, a(n) for n = 1..10000</a>
%H A251555 David L. Applegate, Hans Havermann, Bob Selcoe, Vladimir Shevelev, N. J. A. Sloane, and Reinhard Zumkeller, <a href="http://arxiv.org/abs/1501.01669">The Yellowstone Permutation</a>, arXiv preprint arXiv:1501.01669 [math.NT], 2015 and <a href="https://cs.uwaterloo.ca/journals/JIS/VOL18/Sloane/sloane9.html">J. Int. Seq. 18 (2015) 15.6.7</a>.
%t A251555 a[1]=1; a[2]=3; a[3]=2;
%t A251555 A251555 = Array[a, 3];
%t A251555 a[n_] := a[n] = For[k=2, True, k++, If[FreeQ[A251555, k], If[!CoprimeQ[k, a[n-2]] && CoprimeQ[k, a[n-1]], AppendTo[A251555, k]; Return[k]]]];
%t A251555 A251555 = Array[a, 100] (* _Jean-François Alcover_, Aug 02 2018 *)
%o A251555 (Python)
%o A251555 from math import gcd
%o A251555 A251555_list, l1, l2, s, b = [1,3,2], 2, 3, 4, set()
%o A251555 for _ in range(10**3):
%o A251555     i = s
%o A251555     while True:
%o A251555         if not i in b and gcd(i,l1) == 1 and gcd(i,l2) > 1:
%o A251555             A251555_list.append(i)
%o A251555             l2, l1 = l1, i
%o A251555             b.add(i)
%o A251555             while s in b:
%o A251555                 b.remove(s)
%o A251555                 s += 1
%o A251555             break
%o A251555         i += 1
%o A251555 print(A251555_list) # _Chai Wah Wu_, Dec 21 2014
%o A251555 (Haskell)
%o A251555 import Data.List (delete)
%o A251555 a251555 n = a251555_list !! (n-1)
%o A251555 a251555_list = 1 : 3 : 2 : f 3 2 [4..] where
%o A251555    f u v ws = g ws where
%o A251555      g (x:xs) = if gcd x u > 1 && gcd x v == 1
%o A251555                    then x : f v x (delete x ws) else g xs
%o A251555 -- _Reinhard Zumkeller_, Dec 24 2014
%Y A251555 Cf. A098550, A251554, A252912, A252939, A252940.
%K A251555 nonn
%O A251555 1,2
%A A251555 _N. J. A. Sloane_, Dec 21 2014