OFFSET
0,3
COMMENTS
The sequence seems to grow linearly. The average distance between zeros in the sequence appears to converge to about 7.42.
LINKS
Michael De Vlieger, Table of n, a(n) for n = 0..16384 (terms 0..9999 from Bryle Morga).
Michael De Vlieger, Log log scatterplot of a(n), n = 0..2^20, showing zeros instead as 1/2 in red, otherwise blue.
EXAMPLE
a(1) = a(0) + 1 = 1.
a(2) = a(1) + 2 = 3.
a(3) = 0 because a(2) = 3.
MATHEMATICA
a={0}; For[n=1, n<=70, n++, If[MemberQ[a, n], AppendTo[a, 0], AppendTo[a, Last[a]+n]]]; a (* Stefano Spezia, Jul 26 2024 *)
Fold[If[MemberQ[#1, #2], Append[#1, 0], Append[#1, Last[#1] + #2]] &, {0}, Range @ 10^5] (* Mikk Heidemaa, Oct 05 2024 *)
PROG
(Python)
from itertools import count, islice
def agen(): # generator of terms
seen, an = {0}, 0
for n in count(1):
yield an
an = 0 if n in seen else an + n
seen.add(an)
print(list(islice(agen(), 71))) # Michael S. Branicky, Jul 25 2024
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
Bryle Morga, Jul 25 2024
STATUS
approved