OFFSET
0,3
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..10000
David A. Corneth, PARI program
EXAMPLE
a(2) = 3 = n, thus a(3) = 2.
a(5) = 11, as 5 has not previously appeared in the sequence, but a(4) - 5 = 1 has, thus a(5) = a(4) + 5 = 6 + 5 = 11.
a(5) and a(7) = 11, and 5 * 7 = 35, thus a(11) = 35.
PROG
(PARI) See PARI link
(Python)
from itertools import count, islice
def agen(): # generator of terms
an, p = 0, {0: 0} # data list, map of product of indices
for n in count(1):
yield an
an = p[n] if n in p else an+n if an-n < 0 or an-n in p else an-n
p[an] = p[an]*n if an in p else n
print(list(islice(agen(), 65))) # Michael S. Branicky, Dec 09 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Kelvin Voskuijl, Dec 05 2023
EXTENSIONS
More terms from David A. Corneth, Dec 09 2023
STATUS
approved