OFFSET
1,5
COMMENTS
Theorem: a(n) >= 0 for all n.
LINKS
N. J. A. Sloane, Table of n, a(n) for n = 1..10000
EXAMPLE
A090252 begins
1, 2, 3, 5, 4, 7, 9, 11, 13, ...
and we subtract these numbers from
1, 2, 3, 5, 7, 11, 13, 17, 19, ...
to get
0, 0, 0, 0, 3, 4, 4, 6, 6, ...
PROG
(Python)
from math import gcd, prod
from sympy import isprime, nextprime
from itertools import count, islice
def agen(): # generator of terms
alst, aset, mink, p = [1], {1}, 2, 1
yield 0
for n in count(2):
k, s, p = mink, n - n//2, nextprime(p)
prodall = prod(alst[n-n//2-1:n-1])
while k in aset or gcd(prodall, k) != 1: k += 1
alst.append(k); aset.add(k); yield p - k
while mink in aset: mink += 1
print(list(islice(agen(), 89))) # Michael S. Branicky, May 28 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, May 28 2022
STATUS
approved