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.

A328342 a(0) = 0; for n > 1, if a(n-1) has appeared three or more times then a(n) = total number of terms between the last and second-last appearance of a(n-1), minus the total number of terms between the second-last and third-last appearance of a(n-1). If a(n-1) has appeared two times, a(n) = total number of terms between the last and second-last appearance of a(n-1). If a(n-1) has appeared once, a(n) = 0.

This page as a plain text file.
%I A328342 #13 Oct 14 2019 14:06:52
%S A328342 0,0,1,0,1,2,0,1,1,-2,0,1,2,7,0,0,-3,0,1,4,0,1,-4,0,0,-2,16,0,2,9,0,0,
%T A328342 -2,-9,0,2,-9,3,0,1,15,0,-1,0,-1,2,3,9,18,0,4,31,0,-3,37,0,0,-2,18,10,
%U A328342 0,3,6,0,-1,18,-3,-24,0,2,14,0,-2,-10,0,0,-2,-11,0,2,-14
%N A328342 a(0) = 0; for n > 1, if a(n-1) has appeared three or more times then a(n) = total number of terms between the last and second-last appearance of a(n-1), minus the total number of terms between the second-last and third-last appearance of a(n-1). If a(n-1) has appeared two times, a(n) = total number of terms between the last and second-last appearance of a(n-1). If a(n-1) has appeared once, a(n) = 0.
%C A328342 For the first 10 million terms the largest positive value is 9845628 while the largest negative value is -9748780. The largest positive term that has not appeared is 30832 and the largest negative term that has not appeared is -33426. It is likely that all integers eventually appear in the sequence, although this is unproven.
%H A328342 Scott R. Shannon, <a href="/A328342/a328342.java.txt">Java code to produce the sequence</a>.
%e A328342 a(1) = 0 as a(1-1) = a(0) = 0 has only appeared once.
%e A328342 a(2) = 1 as a(2-1) = a(1) = 0 has appeared twice, and the number of terms between the last and second-last appearance of 0, a(0) and a(1), is 1
%e A328342 a(4) = 1. a(4-1) = a(3) = 0, which has appeared three times. The number of terms between the last and second-last appearance of 0, a(3) and a(1), is 2. The number of terms between the second-last and third-last appearance of 0, a(1) and a(0), is 1. Thus a(4) = 2 - 1 = 1.
%e A328342 a(9) = -2. a(9-1) = a(8) = 1, which has appeared three times. The number of terms between the last and second-last appearance of 1, a(8) and a(7), is 1. The number of terms between the second-last and third-last appearance of 1, a(7) and a(4), is 3. Thus a(9) = 1 - 3 = -2.
%t A328342 s = {0}; Do[d = Differences[Position[s, _?(# == s[[-1]] &)] // Flatten]; a = Switch[Length[d], 0, 0, 1, d[[1]], _, d[[-1]] - d[[-2]]]; AppendTo[s, a], {80}]; s (* _Amiram Eldar_, Oct 13 2019 *)
%Y A328342 Cf. A181391, A328096.
%K A328342 sign
%O A328342 0,6
%A A328342 _Scott R. Shannon_, Oct 12 2019