login
a(n) = number of i in the range 1 <= i <= n such that b(i)=b(n), where b is the sequence A181391 taken with offset 1.
2

%I #14 Dec 24 2021 08:12:35

%S 1,2,1,3,1,4,2,3,2,1,5,1,6,4,2,2,1,7,3,1,8,2,5,1,9,2,2,3,3,1,10,4,4,4,

%T 1,11,5,5,6,6,1,12,5,1,13,6,1,14,7,8,3,1,15,7,2,1,16,3,1,17,9,2,1,18,

%U 4,1,19,10,2,11,7,1,20,6,2,12,7,13,8,2,1,21,3,1,22,14,3,3,1,23,8,1,24,15,4,5,4

%N a(n) = number of i in the range 1 <= i <= n such that b(i)=b(n), where b is the sequence A181391 taken with offset 1.

%C Equivalently, this is the ORDINAL transform of Van Eck's sequence A181391. - _N. J. A. Sloane_, Apr 09 2020

%H Rémy Sigrist, <a href="/A200780/b200780.txt">Table of n, a(n) for n = 1..10000</a>

%H Rémy Sigrist, <a href="/A200780/a200780.txt">C++ program for A200780</a>

%p # The ORDINAL transform of a sequence a[0], a[1], a[2], ... is the sequence b[0], b[1], b[2], ... where b[n] is the number of times a[n] has occurred in [a[0], ..., a[n]].

%p ORDINAL:=proc(a) local b,t1,tlist,clist,n,t,nt;

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

%p t1:=nops(a);

%p tlist:=[];

%p clist:=Array(1..t1,0);

%p b:=[]; nt:=0;

%p for n from 1 to t1 do t:=a[n];

%p if member(t,tlist,'p') then clist[p] := clist[p]+1; b:=[op(b),clist[p]];

%p else nt:=nt+1; tlist:=[op(tlist),t]; clist[nt]:=1; b:=[op(b),1]; fi;

%p od: b; end: # _N. J. A. Sloane_, Apr 09 2020

%p See also A200779.

%o (C++) See Links section.

%Y Cf. A181391.

%K nonn

%O 1,2

%A _N. J. A. Sloane_, Nov 22 2011