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.

A363086 a(0)=a(1)=1. For n>1, let c=count of all occurrences of a(n-1) in the list so far. If c < abs(a(n-1)), then a(n)=c-a(n-1). Otherwise, a(n)=c.

This page as a plain text file.
%I A363086 #19 May 21 2023 23:33:32
%S A363086 1,1,2,-1,1,3,-2,3,-1,2,2,3,3,4,-3,4,-2,2,4,-1,3,5,-4,5,-3,5,-2,3,6,
%T A363086 -5,6,-4,6,-3,3,7,-6,7,-5,7,-4,7,-3,4,4,5,-1,4,6,-2,4,7,-2,5,5,6,-1,5,
%U A363086 7,-1,6,6,7,7,8,-7,8,-6,8,-5,8,-4,4,8,-3,5,8,-2
%N A363086 a(0)=a(1)=1. For n>1, let c=count of all occurrences of a(n-1) in the list so far. If c < abs(a(n-1)), then a(n)=c-a(n-1). Otherwise, a(n)=c.
%C A363086 This is a variant of A363083.
%H A363086 Gavin Lupo, <a href="/A363086/b363086.txt">Table of n, a(n) for n = 0..50000</a>
%H A363086 Gavin Lupo, <a href="/A363086/a363086.png">Image of the first 1000000 terms</a>
%e A363086 a(0) =  1
%e A363086 a(1) =  1
%e A363086 a(2) =  2. Two 1's in the list so far.  2 > abs(1).      c =  2.
%e A363086 a(3) = -1. One 2 in the list so far.    1 < abs(2).  1 - 2 = -1.
%e A363086 a(4) =  1. One -1 in the list so far.   1 = abs(-1).     c =  1.
%o A363086 (Python)
%o A363086 from itertools import islice
%o A363086 from collections import Counter
%o A363086 def agen(): # generator of terms
%o A363086     an, c = 1, Counter([1, 1])
%o A363086     yield from [1, 1]
%o A363086     while True:
%o A363086         an = c[an]-an if c[an] < abs(an) else c[an]
%o A363086         c[an] += 1
%o A363086         yield an
%o A363086 print(list(islice(agen(), 80))) # _Michael S. Branicky_, May 19 2023
%Y A363086 Cf. A363083.
%K A363086 sign,easy,look
%O A363086 0,3
%A A363086 _Gavin Lupo_, May 18 2023