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!)
A044813 Positive integers having distinct base-2 run lengths. 56
1, 3, 4, 6, 7, 8, 14, 15, 16, 24, 28, 30, 31, 32, 35, 39, 48, 49, 55, 57, 59, 60, 62, 63, 64, 67, 79, 96, 97, 111, 112, 120, 121, 123, 124, 126, 127, 128, 131, 135, 143, 159, 192, 193, 223, 224, 225, 239, 241, 247, 248, 249, 251, 252, 254, 255, 256, 259, 263 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
A005811(a(n)) = A165413(a(n)). - Reinhard Zumkeller, Mar 02 2013
From Emeric Deutsch, Jan 25 2018: (Start)
Also, the indices of the compositions that have distinct parts. For the definition of the index of a composition see A298644. For example, 223 is in the sequence since its binary form is 11011111 and the composition [2,1,5] has distinct parts. 100 is not in the sequence since its binary form is 1100100 and the parts of the composition [2,2,1,2] are not distinct.
The command c(n) from the Maple program yields the composition having index n. (End)
LINKS
Reinhard Zumkeller and Gheorghe Coserea, Table of n, a(n) for n = 1..20000 (first 5000 terms from Reinhard Zumkeller)
FORMULA
a(Sum_{k=0..n} A032020(k)) = 2^n, for n>1. - Gheorghe Coserea, May 30 2017
MAPLE
Runs := proc (L) local j, r, i, k: j := 1: r[j] := L[1]: for i from 2 to nops(L) do if L[i] = L[i-1] then r[j] := r[j], L[i] else j := j+1: r[j] := L[i] end if end do: [seq([r[k]], k = 1 .. j)] end proc: RunLengths := proc (L) map(nops, Runs(L)) end proc: c := proc (n) ListTools:-Reverse(convert(n, base, 2)): RunLengths(%) end proc: A := {}: for n to 300 do if nops(convert(c(n), set)) = nops(c(n)) then A := `union`(A, {n}) else end if end do: A; # most of the Maple program is due to W. Edwin Clark. - Emeric Deutsch, Jan 25 2018
MATHEMATICA
f[n_] := Unequal@@Length/@Split[IntegerDigits[n, 2]]; Select[Range[300], f] (* Ray Chandler, Oct 21 2011 *)
PROG
(Haskell)
import Data.List (group, nub)
a044813 n = a044813_list !! (n-1)
a044813_list = filter p [1..] where
p x = nub xs == xs where
xs = map length $ group $ a030308_row x
-- Reinhard Zumkeller, Mar 02 2013
(PARI)
is(n) = {
my(v = 0, hist = vector(1 + logint(n+1, 2)));
while(n != 0,
v = valuation(n, 2); n >>= v; n++;
hist[v+1]++; if (hist[v+1] >= 2, return(0));
v = valuation(n, 2); n >>= v; n--;
hist[v+1]++; if (hist[v+1] >= 2, return(0)));
return(1);
};
seq(n) = {
my(k = 1, top = 0, v = vector(n));
while(top < n, if (is(k), v[top++] = k); k++);
return(v);
};
seq(59) \\ Gheorghe Coserea, Nov 02 2015
(Python)
from itertools import groupby
def ok(n):
runlengths = [len(list(g)) for k, g in groupby(bin(n)[2:])]
return len(runlengths) == len(set(runlengths))
print([i for i in range(1, 264) if ok(i)]) # Michael S. Branicky, Jan 04 2021
CROSSREFS
Sequence in context: A239458 A007370 A322376 * A154661 A275672 A087753
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
Extended by Ray Chandler, Oct 21 2011
STATUS
approved

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 25 11:23 EDT 2024. Contains 371967 sequences. (Running on oeis4.)