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.

A363198 a(n) = n for n <= 3; for n >= 4, a(n) is the smallest positive integer that has not appeared previously in this sequence and shares a factor with a(n-1) + a(n-2) + a(n-3).

This page as a plain text file.
%I A363198 #41 Dec 30 2023 23:07:49
%S A363198 1,2,3,4,6,13,23,7,43,73,9,5,12,8,10,14,16,15,18,21,20,59,22,101,24,
%T A363198 27,19,25,71,30,26,127,33,28,32,31,35,34,36,39,109,38,40,11,89,42,44,
%U A363198 45,131,46,37,48,262,347,51,50,49,52,151,54,257,55,56,58,65
%N A363198 a(n) = n for n <= 3; for n >= 4, a(n) is the smallest positive integer that has not appeared previously in this sequence and shares a factor with a(n-1) + a(n-2) + a(n-3).
%C A363198 Conjecture: This sequence is a permutation of the natural numbers.
%H A363198 Yifan Xie, <a href="/A363198/b363198.txt">Table of n, a(n) for n = 1..2000</a>
%t A363198 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];
%t A363198 Table[a[n], {n, 1, 65}] (* _Robert P. P. McKone_, Dec 30 2023 *)
%o A363198 (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;}
%o A363198 (Python)
%o A363198 from math import gcd
%o A363198 a = [1, 2, 3]
%o A363198 t = set(a)
%o A363198 def next_element():
%o A363198     s = a[-1] + a[-2] + a[-3]
%o A363198     n = 1
%o A363198     while n in t or gcd(s, n) == 1:
%o A363198         n += 1
%o A363198     return n
%o A363198 def a_seq(ul):
%o A363198     for _ in range(4, ul + 1):
%o A363198         nn = next_element()
%o A363198         a.append(nn)
%o A363198         t.add(nn)
%o A363198     return a
%o A363198 print(a_seq(65)) # _Robert P. P. McKone_, Dec 30 2023
%Y A363198 Cf. A064413, A337136.
%K A363198 nonn,easy
%O A363198 1,2
%A A363198 _Yifan Xie_, May 21 2023