login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A044821 Positive integers having distinct base-10 run lengths. 18

%I #22 Jan 04 2021 18:19:48

%S 1,2,3,4,5,6,7,8,9,11,22,33,44,55,66,77,88,99,100,110,111,112,113,114,

%T 115,116,117,118,119,122,133,144,155,166,177,188,199,200,211,220,221,

%U 222,223,224,225,226,227,228,229,233,244,255

%N Positive integers having distinct base-10 run lengths.

%H David A. Corneth, <a href="/A044821/b044821.txt">Table of n, a(n) for n = 1..10000</a>

%e 117 is in the sequence because it has a run length of 2 and a run length of 1. 101 is not in the sequence because it has three run lengths of 1. - _R. J. Mathar_, Jan 18 2018

%p rlset := proc(L::list)

%p local lset,rl,i ;

%p lset := [] ;

%p rl := 1 ;

%p for i from 2 to nops(L) do

%p if op(i,L) = op(i-1,L) then

%p rl := rl+1 ;

%p else

%p lset := [op(lset),rl] ;

%p rl := 1;

%p end if;

%p end do:

%p lset := [op(lset),rl] ;

%p end proc:

%p isA044821 := proc(n)

%p local dgs,rl;

%p dgs := convert(n,base,10) ;

%p rl := rlset(dgs) ;

%p if nops(rl) = nops( convert(rl,set)) then

%p true;

%p else

%p false;

%p end if;

%p end proc:

%p for n from 1 to 400 do

%p if isA044821(n) then

%p printf("%d,",n) ;

%p end if;

%p end do: # _R. J. Mathar_, Jan 18 2018

%o (Python)

%o from itertools import groupby

%o def ok(n):

%o runlengths = [len(list(g)) for k, g in groupby(str(n))]

%o return len(runlengths) == len(set(runlengths))

%o print([i for i in range(1, 256) if ok(i)]) # _Michael S. Branicky_, Jan 04 2021

%o (PARI) is(n) = { my(runs = List(), lr = 0, d = digits(n)); for(i = 1, #d - 1, if(d[i] != d[i + 1], listput(runs, i - lr); lr = i; ) ); listput(runs, #d - lr); #Set(runs) == #runs } \\ _David A. Corneth_, Jan 04 2021

%Y Cf. A044813, A044814, A044815, A044816, A044817, A044818, A044819, A044820, A044821, A044822, A044823, A044824, A044825, A044826, A044827 (base 2 to base 16).

%K nonn,base

%O 1,2

%A _Clark Kimberling_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 06:34 EDT 2024. Contains 371920 sequences. (Running on oeis4.)