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.

A171899 Backwards van Eck transform of A000002.

This page as a plain text file.
%I A171899 #6 Jun 16 2019 08:08:11
%S A171899 0,0,1,3,1,3,2,2,1,3,2,1,3,1,3,2,1,3,1,3,2,2,1,3,2,2,1,3,1,3,2,1,3,2,
%T A171899 2,1,3,2,1,3,1,3,2,2,1,3,2,2,1,3,2,1,3,1,3,2,1,3,1,3,2,2,1,3,2,1,3,1,
%U A171899 3,2,1,3,2,2,1,3,2,2,1,3,1,3,2,1,3,1,3,2,2,1,3,2,1,3,1,3,2,1,3,1,3,2,2,1,3
%N A171899 Backwards van Eck transform of A000002.
%C A171899 Given a sequence a, the backwards van Eck transform b is defined as follows: If a(n) has already appeared in a, let a(m) be the most recent occurrence, and set b(n)=n-m; otherwise b(n)=0.
%C A171899 The forwards van Eck transform of A000002 is A078929.
%p A171899 ECKb:=proc(a) local b,i,m,n;
%p A171899 if whattype(a) <> list then RETURN([]); fi:
%p A171899 b:=[0];
%p A171899 for n from 2 to nops(a) do
%p A171899 # has a(n) appeared before?
%p A171899 m:=0;
%p A171899 for i from n-1 by -1 to 1 do
%p A171899 if (a[i]=a[n]) then m:=n-i; break; fi
%p A171899 od:
%p A171899 b:=[op(b),m];
%p A171899 od:
%p A171899 RETURN(b);
%p A171899 end:
%Y A171899 Cf. A000002, A181391, A171898, A078929.
%K A171899 nonn
%O A171899 1,4
%A A171899 _N. J. A. Sloane_, Oct 22 2010