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.

A328096 a(0) = 0; a(1) = 1; for n > 1, a(n) = number of terms between the two previous occurrences of a(n-1) if a(n-1) has appeared two or more times, otherwise a(n) = 0.

This page as a plain text file.
%I A328096 #17 Oct 05 2019 04:05:27
%S A328096 0,1,0,1,1,0,2,0,1,3,0,2,4,0,2,2,0,2,1,9,0,3,11,0,2,6,0,2,2,0,2,1,12,
%T A328096 0,3,12,2,5,0,4,26,0,2,5,5,0,3,11,24,0,3,3,0,2,10,0,2,2,0,2,1,28,0,3,
%U A328096 11,16,0,3,3,0,2,10,16,6,47,0,5,31,0,2,8
%N A328096 a(0) = 0; a(1) = 1; for n > 1, a(n) = number of terms between the two previous occurrences of a(n-1) if a(n-1) has appeared two or more times, otherwise a(n) = 0.
%C A328096 In the first 10000 terms the largest entry is 9040, which is the number of terms between the two appearances of 217. The longest run of nonzero values is 19, starting at a(9740) = 3 and ending at a(9758) = 6400. The smallest number not appearing is 258.
%H A328096 Scott R. Shannon, <a href="/A328096/b328096.txt">Table of n, a(n) for n = 0..10000</a>
%e A328096 a(3) = 1 as there is 1 term between a(3-1) = a(2) = 0 and a(0) = 0.
%e A328096 a(5) = 0 as there are no terms between a(5-1) = a(4) = 1 and a(3) = 1.
%e A328096 a(7) = 0 as a(7-1) = a(6) = 2 has only appeared once up to n = 7.
%e A328096 a(12) = 4 as there are 4 terms between a(12-1) = a(11) = 2 and a(6) = 2.
%e A328096 a(22) = 11 as there are 11 terms between a(22-1) = a(21) = 3 and a(9) = 3.
%p A328096 a:= proc(n) option remember; local t, j;
%p A328096       if n<2 then n else t:= a(n-1);
%p A328096         for j from 2 to n do
%p A328096           if a(n-j)=t then return j-2 fi
%p A328096         od; 0
%p A328096       fi
%p A328096     end:
%p A328096 seq(a(n), n=0..100);  # _Alois P. Heinz_, Oct 04 2019
%t A328096 a = {0,1}; While[Length@a < 90, p = Flatten@ Position[Reverse@ a, Last@a, 1, 2]; AppendTo[a, If[ Length@p == 1, 0, p[[2]] - p[[1]] - 1]]]; a (* _Giovanni Resta_, Oct 04 2019 *)
%Y A328096 Cf. A181391, A309261.
%K A328096 nonn
%O A328096 0,7
%A A328096 _Scott R. Shannon_, Oct 04 2019