login
a(1) = 1, a(2) = 2, a(3) = 3; for n > 3, a(n) is the smallest new number such that the sum of any four successive terms is prime.
0

%I #30 Aug 24 2022 09:59:09

%S 1,2,3,5,7,4,13,17,9,8,19,11,15,14,21,23,25,10,31,35,27,16,29,37,45,

%T 20,47,39,33,12,43,49,53,6,41,51,59,22,61,55,73,34,65,57,67,38,71,63,

%U 69,24,77,81,75,18,83,87,89,48,93,101,95,28

%N a(1) = 1, a(2) = 2, a(3) = 3; for n > 3, a(n) is the smallest new number such that the sum of any four successive terms is prime.

%t s = {1, 2, 3}; Do[a = s[[-1]] + s[[-2]] + s[[-3]]; n = 4; While[MemberQ[s, n] || ! PrimeQ[a + n], n++]; AppendTo[s, n], {120}]; s

%o (PARI) { s = 0; for (n=1, #a = vector(62), if (n<=3, a[n]=n, for (v=1, oo, if (!bittest(s,v) && isprime(v+a[n-1]+a[n-2]+a[n-3]), a[n]=v; break))); print1 (a[n]", "); s+=2^a[n]) } \\ _Rémy Sigrist_, Jul 03 2022

%Y Cf. A080164, A336816, A302847.

%Y See A055265 and A076990 for similar sequences.

%K nonn

%O 1,2

%A _Zak Seidov_, Jun 13 2022