A343070 a(1) = 1, for n > 1, a(n) is the smallest positive integer for which a(n-1) + n + a(n) is a prime.
1, 2, 2, 1, 1, 4, 2, 1, 1, 2, 4, 1, 3, 2, 2, 1, 1, 4, 6, 3, 5, 2, 4, 1, 3, 2, 2, 1, 1, 6, 4, 1, 3, 4, 2, 3, 1, 2, 2, 1, 1, 4, 6, 3, 5, 2, 4, 1, 3, 6, 2, 5, 1, 4, 2, 1, 1, 2, 6, 1, 5, 4, 4, 3, 3, 2, 2, 1, 1, 2, 6, 1, 5, 4, 4, 3, 3, 2, 2, 1, 1, 6, 8
Offset: 1
Keywords
Links
- Todor Szimeonov, A completive sequence
Crossrefs
Cf. A343039.
Programs
-
Mathematica
a[1] = 1; a[n_] := a[n] = NextPrime[a[n - 1] + n] - a[n - 1] - n; Array[a, 100] (* Amiram Eldar, Apr 04 2021 *)
-
Python
from sympy import nextprime def aupton(terms): alst = [1] for n in range(2, terms+1): alst.append(nextprime(alst[-1] + n) - alst[-1] - n) return alst print(aupton(87)) # Michael S. Branicky, Apr 04 2021