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.

A103683 a(1)=1, a(2)=2, a(3)=3, a(n) = smallest positive integer not occurring earlier in sequence and coprime to a(n-1), a(n-2) and a(n-3).

This page as a plain text file.
%I A103683 #56 May 13 2022 05:14:56
%S A103683 1,2,3,5,7,4,9,11,13,8,15,17,19,14,23,25,27,16,29,31,21,10,37,41,33,
%T A103683 20,43,47,39,22,35,53,51,26,49,55,57,32,59,61,45,28,67,71,65,6,73,77,
%U A103683 79,12,83,85,89,18,91,95,97,24,101,103,107,30,109,113,119,36,115,121,127,34
%N A103683 a(1)=1, a(2)=2, a(3)=3, a(n) = smallest positive integer not occurring earlier in sequence and coprime to a(n-1), a(n-2) and a(n-3).
%C A103683 Conjectured to be not a permutation of the natural numbers.
%C A103683 _Charles R Greathouse IV_ extended this, and confirms that primes occur in natural order. - _Jonathan Vos Post_ and _M. F. Hasler_, Jan 18 2011
%C A103683 Conjecture: for n >= 67, a(n) is even if and only if n == 2 (mod 4) and divisible by 3 if and only if n == 3 (mod 4).  In particular, this implies the last value divisible by 6 is a(66) = 36. - _Robert Israel_, May 12 2015
%C A103683 a(102982) = 42, see A105214. Conjecture above is false. - _Sergio Pimentel_, Apr 18 2022
%H A103683 Alois P. Heinz, <a href="/A103683/b103683.txt">Table of n, a(n) for n = 1..10000</a>
%p A103683 ina:= proc(n) false end:
%p A103683 a:= proc(n) option remember; local k;
%p A103683       if n<4 then k:= n
%p A103683     else for k from 4 while ina(k) or igcd(k, a(n-1))<>1 or
%p A103683                 igcd(k, a(n-2))<>1 or igcd(k, a(n-3))<>1
%p A103683          do od
%p A103683       fi; ina(k):= true; k
%p A103683     end:
%p A103683 seq(a(n), n=1..120);  # _Alois P. Heinz_, Jan 19 2011
%t A103683 f[s_] := Block[{k = 1, l = Take[s, -3]}, While[ Union[ GCD[k, l]] != {1} || MemberQ[s, k], k++]; Append[s, k]]; Nest[f, {1, 2, 3}, 70] (* _Robert G. Wilson v_, Jun 26 2011 *)
%o A103683 (Python)
%o A103683 from math import gcd
%o A103683 from itertools import islice
%o A103683 def agen(): # generator of terms
%o A103683     aset, b, c, d = {1, 2, 3, 5}, 2, 3, 5
%o A103683     yield from [1, b, c, d]
%o A103683     while True:
%o A103683         k = 1
%o A103683         while k in aset or any(gcd(t, k) != 1 for t in [b, c, d]): k+= 1
%o A103683         b, c, d = c, d, k
%o A103683         aset.add(k)
%o A103683         yield k
%o A103683 print(list(islice(agen(), 70))) # _Michael S. Branicky_, Apr 18 2022
%Y A103683 Cf. A084937, A105214, A352950.
%K A103683 nonn
%O A103683 1,2
%A A103683 _Leroy Quet_, Mar 26 2005
%E A103683 More terms from _Robert G. Wilson v_, Mar 30 2005