OFFSET
1,2
COMMENTS
Conjectured to be not a permutation of the natural numbers.
Charles R Greathouse IV extended this, and confirms that primes occur in natural order. - Jonathan Vos Post and M. F. Hasler, Jan 18 2011
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
a(102982) = 42, see A105214. Conjecture above is false. - Sergio Pimentel, Apr 18 2022
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
MAPLE
ina:= proc(n) false end:
a:= proc(n) option remember; local k;
if n<4 then k:= n
else for k from 4 while ina(k) or igcd(k, a(n-1))<>1 or
igcd(k, a(n-2))<>1 or igcd(k, a(n-3))<>1
do od
fi; ina(k):= true; k
end:
seq(a(n), n=1..120); # Alois P. Heinz, Jan 19 2011
MATHEMATICA
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 *)
PROG
(Python)
from math import gcd
from itertools import islice
def agen(): # generator of terms
aset, b, c, d = {1, 2, 3, 5}, 2, 3, 5
yield from [1, b, c, d]
while True:
k = 1
while k in aset or any(gcd(t, k) != 1 for t in [b, c, d]): k+= 1
b, c, d = c, d, k
aset.add(k)
yield k
print(list(islice(agen(), 70))) # Michael S. Branicky, Apr 18 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Mar 26 2005
EXTENSIONS
More terms from Robert G. Wilson v, Mar 30 2005
STATUS
approved