OFFSET
1,2
COMMENTS
Conjecture: This sequence is a permutation of the natural numbers.
LINKS
Yifan Xie, Table of n, a(n) for n = 1..2000
MATHEMATICA
a[1] = 1; a[2] = 2; a[3] = 3; a[n_] := a[n] = Module[{s, i = 1}, s = a[n - 1] + a[n - 2] + a[n - 3]; While[MemberQ[a /@ Range[1, n - 1], i] || GCD[s, i] == 1, i++]; i];
Table[a[n], {n, 1, 65}] (* Robert P. P. McKone, Dec 30 2023 *)
PROG
(PARI) lista(nn) = {my(v = [1, 2, 3]); for(n=4, nn, my(t=1); while(prod(X=1, n-1, v[X]-t)==0 || gcd(v[n-3]+v[n-2]+v[n-1], t)==1, t++); v=concat(v, t)); v; }
(Python)
from math import gcd
a = [1, 2, 3]
t = set(a)
def next_element():
s = a[-1] + a[-2] + a[-3]
n = 1
while n in t or gcd(s, n) == 1:
n += 1
return n
def a_seq(ul):
for _ in range(4, ul + 1):
nn = next_element()
a.append(nn)
t.add(nn)
return a
print(a_seq(65)) # Robert P. P. McKone, Dec 30 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Yifan Xie, May 21 2023
STATUS
approved