The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation. Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A309596 If a(n) is not a term of a(0..n-1), then a(n+1) = a(n) - a(n - a(n)); otherwise a(n+1) is the number of terms equal to a(n) in a(0..n-1). Start with a(0)=0, a(1)=0. 0
 0, 0, 1, 1, 1, 2, 1, 3, 2, 1, 4, 3, 1, 5, 3, 2, 2, 3, 3, 4, 1, 6, 4, 2, 4, 3, 5, 1, 7, 1, 8, 4, 4, 5, 2, 5, 3, 6, 1, 9, 1, 10, 6, 2, 6, 3, 7, 1, 11, 5, 4, 6, 4, 7, 2, 7, 3, 8, 1, 12, 11, 1, 13, 8, 2, 8, 3, 9, 1, 14, 7, 4 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,6 COMMENTS In other words, if the last term a(n) has not appeared previously, subtract the term a(n - a(n)) from a(n) to get the next term. Otherwise, count the terms equal to the last term a(n) in a(0..n-1) to get the next term. This sequence has no repeating pattern because of the rule a(n+1) = a(n) - a(n - a(n)). A new record in the sequence is always the previous record + 1. Therefore all terms are >= 0. LINKS EXAMPLE a(0)=0 (given). a(1)=0 (given). a(2)=1: a(1)=0 is a term of a(0..0), therefore a(2) = Number of terms=0 in a(0..0) = 1. a(3)=1: a(2)=1 is not a term of a(0..1), therefore: a(3) = a(2) - a(2 - 1) = 1 - 0 = 1. a(4)=1: a(3)=1 is a term of a(0..2), therefore a(4) = Number of terms=1 in a(0..2) = 1. a(5)=2: a(4)=1 is a term of a(0..3), therefore a(5) = Number of terms=1 in a(0..3) = 2. a(6)=1: a(5)=2 is not a term of a(0..4), therefore: a(6) = a(5) - a(5 - 2) = 2 - 1 = 1. MATHEMATICA s={0, 0}; Do[s1 = If[(c = Count[s[[1;; -2]], s[[-1]]]) == 0, s[[-1]] - s[[-1 -  s[[-1]]]], c]; AppendTo[s, s1], {100}]; s (* Amiram Eldar, Aug 13 2019 *) PROG (Python) sa, n = , 0 print(n, sa[n]) while n < 50:     i, j = 0, 0     while i < n:         if sa[i] == sa[n]:             j = j+1         i = i+1     if j == 0:         a = sa[n] - sa[n-sa[n]]     else:         a = j     n = n+1     print(n, a)     sa = sa+[a] # A.H.M. Smeets, Aug 09 2019 CROSSREFS Cf. A181391, A309035. Sequence in context: A278104 A141672 A141671 * A226247 A233742 A194856 Adjacent sequences:  A309593 A309594 A309595 * A309597 A309598 A309599 KEYWORD nonn AUTHOR Marc Morgenegg, Aug 09 2019 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified April 3 21:54 EDT 2020. Contains 333207 sequences. (Running on oeis4.)