cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A364835 a(1) = 1; a(n+1) = (number of times a(n)+1 has appeared) - (number of times a(n) has appeared).

This page as a plain text file.
%I A364835 #43 Sep 01 2023 14:06:15
%S A364835 1,-1,-1,-2,1,-2,0,1,-3,1,-4,0,2,-1,-1,-2,1,-4,-1,-3,1,-5,1,-6,0,4,-1,
%T A364835 -3,0,3,0,2,-1,-2,3,-1,-3,0,1,-6,-1,-3,-1,-4,2,-1,-5,1,-6,-1,-6,-2,7,
%U A364835 -1,-7,3,-2,7,-2,6,1,-7,2,-1,-8,1,-7,1,-8,1,-9,1,-10,0,7,-3,1,-11,0
%N A364835 a(1) = 1; a(n+1) = (number of times a(n)+1 has appeared) - (number of times a(n) has appeared).
%C A364835 Irregular until n=149695 at which point it follows a simple pattern (see formula).
%H A364835 Rok Cestnik, <a href="/A364835/b364835.txt">Table of n, a(n) for n = 1..1000</a>
%H A364835 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,2,0,0,-1).
%F A364835 For n >= 149695: a(n) = 49456 - n/3 if (n mod 3) = 0, otherwise a(n) = (n mod 3) - 1.
%e A364835 a(5) = 2 - 1 = 1 because a(4) + 1 = -1 has appeared twice before and a(4) = -2 has appeared once.
%e A364835 a(7) = 2 - 2 = 0 because a(6) + 1 = -1 and a(6) = -2 have both appeared twice before.
%t A364835 nmax=78; a={1}; For[n=1, n<=nmax, n++, AppendTo[a,Count[a,Part[a,n]+1]-Count[a,Part[a,n]]]]; a (* _Stefano Spezia_, Aug 29 2023 *)
%o A364835 (Python)
%o A364835 a=[1]
%o A364835 for n in range(1000):
%o A364835     a.append(a.count(a[n]+1)-a.count(a[n]))
%o A364835 (Python)
%o A364835 from itertools import islice
%o A364835 from collections import Counter
%o A364835 def agen(): # generator of terms
%o A364835     an = 1; c = Counter([1])
%o A364835     while True: yield an; an = c[an+1] - c[an]; c[an] += 1
%o A364835 print(list(islice(agen(),1001))) # _Michael S. Branicky_, Aug 29 2023
%Y A364835 Cf. A330004, A329934.
%K A364835 sign,easy,look
%O A364835 1,4
%A A364835 _Rok Cestnik_, Aug 28 2023