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.

A363083 a(0)=a(1)=1. For n>1, if the number of occurrences of a(n-1) is less than abs(a(n-1)), then a(n)=a(n-1)-a(n-2). Otherwise, a(n)=a(n-1)+a(n-2).

This page as a plain text file.
%I A363083 #38 Apr 01 2025 16:06:31
%S A363083 1,1,2,1,3,2,5,3,-2,-5,-3,2,-1,1,0,1,1,2,3,5,2,7,5,-2,3,1,4,3,7,4,-3,
%T A363083 -7,-4,3,-1,2,1,3,4,1,5,4,9,5,14,9,-5,-14,-9,5,-4,-9,-5,4,-1,3,2,5,7,
%U A363083 2,9,7,-2,5,3,8,5,13,8,-5,-13,-8,5,-3,2,-1,1,0
%N A363083 a(0)=a(1)=1. For n>1, if the number of occurrences of a(n-1) is less than abs(a(n-1)), then a(n)=a(n-1)-a(n-2). Otherwise, a(n)=a(n-1)+a(n-2).
%H A363083 Gavin Lupo, <a href="/A363083/b363083.txt">Table of n, a(n) for n = 0..50000</a>
%H A363083 Gavin Lupo, <a href="/A363083/a363083.png">Image of the first 100000 terms.</a>
%H A363083 Gavin Lupo, <a href="/A363083/a363083_1.png">Image of the first 1000000 terms.</a>
%H A363083 Gavin Lupo, <a href="/A363083/a363083_2.png">Image of the first 10000000 terms.</a>
%H A363083 Gavin Lupo, <a href="/A363083/a363083_3.jpg">Image of the first 25000000 terms.</a>
%e A363083 a(0) = 1
%e A363083 a(1) = 1
%e A363083 a(2) = 2. Two 1's in the list so far.    2 > abs(1).   1 + 1 = 2.
%e A363083 a(3) = 1. One 2 in the list so far.      1 < abs(2).   2 - 1 = 1.
%e A363083 a(4) = 3. Three 1's in the list so far.  3 > abs(1).   1 + 2 = 3.
%o A363083 (Python)
%o A363083 from itertools import islice
%o A363083 from collections import Counter
%o A363083 def agen(): # generator of terms
%o A363083     anprev, an, c = 1, 1, Counter([1])
%o A363083     yield 1
%o A363083     while True:
%o A363083         yield an
%o A363083         c[an] += 1
%o A363083         anprev, an = an, an-anprev if c[an] < abs(an) else an+anprev
%o A363083 print(list(islice(agen(), 80))) # _Michael S. Branicky_, May 18 2023
%Y A363083 Cf. A329985, A362746, A362890, A363086.
%K A363083 sign,easy,look
%O A363083 0,3
%A A363083 _Gavin Lupo_, May 18 2023