This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A171899 Backwards Van Eck transform of A000002. 3

%I

%S 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 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 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 Backwards Van Eck transform of A000002.

%C 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 The forwards Van Eck transform of A000002 is A078929.

%p ECKb:=proc(a) local b,i,m,n;

%p if whattype(a) <> list then RETURN([]); fi:

%p b:=[0];

%p for n from 2 to nops(a) do

%p # has a(n) appeared before?

%p m:=0;

%p for i from n-1 by -1 to 1 do

%p if (a[i]=a[n]) then m:=n-i; break; fi

%p od:

%p b:=[op(b),m];

%p od:

%p RETURN(b);

%p end:

%Y Cf. A000002, A181391, A171898, A078929.

%K nonn

%O 1,4

%A _N. J. A. Sloane_, Oct 22 2010

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified May 20 09:42 EDT 2013. Contains 225458 sequences.