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 A097465 #23 May 06 2022 21:38:36 %S A097465 1,3,5,2,7,4,9,11,6,13,8,15,17,10,19,12,23,14,25,16,21,26,29,18,31,20, %T A097465 27,22,35,24,37,28,33,38,41,30,43,32,39,34,45,47,36,49,40,51,44,53,42, %U A097465 55,46,57,50,59,48,61,52,63,58,65,54,67,56,69,62,71,60,73,64,75,68,77 %N A097465 a(1) = 1; for n>1, a(n) = smallest positive integer which is not among earlier terms of sequence, is coprime to a(n-1) and is not equal to a(n-1) +- 1. %C A097465 A permutation of the positive integers. [This follows easily by standard arguments. One shows that all primes appear. If a number k is missing, find a prime term P that is much greater than k. Then the term following P will be k. Contradiction. - _N. J. A. Sloane_, May 06 2022] %H A097465 Michael De Vlieger, <a href="/A097465/b097465.txt">Table of n, a(n) for n = 1..10000</a> %e A097465 a(8) = 11 because, among the positive integers not occurring earlier in the sequence (6,8,10,11,12,...), 11 is the smallest which is coprime to a(7)=9, is not a(7)+1=10 and is not a(7)-1=8. %p A097465 A:=proc(n) option remember; local t, S; S:=({$1..1000} minus {seq(A(i),i=1..n-1)}) minus {A(n-1)-1,A(n-1)+1}; t:=min(S[]); while igcd(A(n-1),t)>1 do S:=S minus {t}; t:=min(S[]) od; t end: A(1):=1: seq(A(n), n=1..200); # Alec Mihailovs (alec(AT)mihailovs.com), Aug 23 2004 %t A097465 a[1] = 1; a[n_] := a[n] = Block[{t = Table[ a[i], {i, n - 1}], k = 2}, While[k == a[n - 1] - 1 || k == a[n - 1] + 1 || GCD[a[n - 1], k] != 1 || Position[t, k] != {}, k++ ]; k]; Table[ a[n], {n, 50}] (* _Robert G. Wilson v_, Aug 23 2004 *) %o A097465 (Python) %o A097465 from math import gcd %o A097465 from itertools import islice %o A097465 def agen(): # generator of terms %o A097465 an, aset, mink = 1, {1}, 2 %o A097465 while True: %o A097465 yield an %o A097465 k = mink %o A097465 while k in aset or gcd(an, k) != 1 or abs(k-an) == 1: k += 1 %o A097465 an = k %o A097465 aset.add(an) %o A097465 while mink in aset: mink += 1 %o A097465 print(list(islice(agen(), 72))) # _Michael S. Branicky_, May 02 2022 %Y A097465 Cf. A093714, A097467, A353711. %K A097465 nonn %O A097465 1,2 %A A097465 _Leroy Quet_, Aug 23 2004 %E A097465 More terms from Alec Mihailovs (alec(AT)mihailovs.com) and _Robert G. Wilson v_, Aug 23 2004