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 A177958 #35 Oct 27 2023 21:59:55 %S A177958 1,2,3,4,5,6,12,18,9,27,36,24,8,16,32,40,10,20,30,15,45,54,42,7,14,21, %T A177958 28,35,49,56,48,60,50,25,75,90,63,70,77,11,22,33,44,55,66,72,64,80,88, %U A177958 96,78,13,26,39,52,65,91,84,98,105 %N A177958 a(n) = n for n <= 6; for n > 6, a(n) is the smallest number not already used such that gcd(a(n), a(n-1)) >= 6. %C A177958 A permutation of the natural numbers. %H A177958 Alois P. Heinz, <a href="/A177958/b177958.txt">Table of n, a(n) for n = 1..10000</a> (first 2000 terms from Ivan Neretin) %H A177958 J. C. Lagarias, E. M. Rains and N. J. A. Sloane, <a href="http://www.emis.de/journals/EM/expmath/volumes/11/11.3/Lagarias437_446.pdf">The EKG sequence</a>, Exper. Math. 11 (2002), 437-446. %H A177958 J. C. Lagarias, E. M. Rains and N. J. A. Sloane, <a href="http://arxiv.org/abs/math/0204011">The EKG sequence</a>, arXiv:math/0204011 [math.NT], 2002. %H A177958 <a href="/index/Ed#EKG">Index entries for sequences related to EKG sequence</a> %H A177958 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %p A177958 ina:= proc(n) evalb(n<7) end: %p A177958 a:= proc(n) option remember; %p A177958 local k; %p A177958 if n<7 then n %p A177958 else for k while ina(k) or igcd (k, a(n-1))<6 do od; %p A177958 ina(k):= true; k %p A177958 fi %p A177958 end; %p A177958 seq(a(n), n=1..60); %t A177958 t=Range[6]; Do[k=7; While[MemberQ[t, k] || GCD[t[[-1]], k] < 6, k++]; AppendTo[t, k], {n, 7, 100}]; t %o A177958 (Python) %o A177958 from sympy import gcd %o A177958 l=list(range(1, 7)) %o A177958 for n in range(6, 101): %o A177958 k=7 %o A177958 while k in l or gcd(l[n - 1], k)<6: k+=1 %o A177958 l.append(k) %o A177958 print(l) # _Indranil Ghosh_, Jun 27 2017 %Y A177958 Cf. A064413, A064417, A064418, A064419, A262434 (inverse). %K A177958 nonn,easy %O A177958 1,2 %A A177958 _Jonathan Vos Post_, Dec 16 2010 %E A177958 Edited by _Alois P. Heinz_, Dec 16 2010